all repos — h3rald @ 1b87ee58bf476fe6fe3181c185fd295f66d0203f

The sources of https://h3rald.com

Improvements to theme switcher & SVG icon titles.
h3rald h3rald@h3rald.com
Mon, 19 Feb 2024 14:45:08 +0100
commit

1b87ee58bf476fe6fe3181c185fd295f66d0203f

parent

a02cda610d75e1138a53ade89b1b9a9d8cf79efc

3 files changed, 16 insertions(+), 4 deletions(-)

jump to
M assets/styles/style.cssassets/styles/style.css

@@ -8,6 +8,11 @@ margin: 2px;

margin-right: 10px; } +.theme-switcher-icon svg { + width: 14px; + height: 14px; +} + #theme-switcher { display: none; }

@@ -56,6 +61,7 @@ --warning-color: #FFAF00;

--error-color: #DB141A; } +/* .theme-switcher-icon.dark-mode-hide::after { content: " dark mode"; color: var(--primary-text-color);

@@ -65,6 +71,7 @@ .theme-switcher-icon::after {

content: " light mode"; color: var(--primary-text-color); } +*/ .themed-content .light-mode-hide { display: initial;
M rules.minrules.min

@@ -145,16 +145,21 @@ (str :id str :text ==> str :result)

( ; whitelist of common false positives for icon markup ("borrow", "http", "cakephp") :whitelist - text ":([a-z]+[a-z0-9-]+):" ( + text ":([a-z]+[a-z0-9-]+)(?:\|([a-zA-Z0-9 ]+))?:" ( :match match 0 get :content match 1 get :icon + match 2 get :explicit-title "assets/images/entypo/$#.svg" (icon) =% :path (path file?) ( path fread from-xml "svg" xquery :svgx + icon :title + (explicit-title "" !=) + (explicit-title @title) + when ; Add title tag - "<title>$#</title>" (icon) =% from-xml :svg-title + "<title>$#</title>" (title) =% from-xml :svg-title svgx dup /children svg-title swap prepend %children @svgx ; Add role="img" svgx /attributes :svg-attrs
M templates/_theme_switcher.mustachetemplates/_theme_switcher.mustache

@@ -1,5 +1,5 @@

<input id="theme-switcher" type="checkbox" name="theme-switcher"> <label for="theme-switcher" class="themed-content"> - <span class="dark-mode-hide theme-switcher-icon">:moon:</span> - <span class="light-mode-hide theme-switcher-icon">:light-up:</span> + <span class="dark-mode-hide theme-switcher-icon">:moon|Switch to Dark Mode:</span> + <span class="light-mode-hide theme-switcher-icon">:light-up|Switch to Light Mode:</span> </label>