From 3470c6b8d73e6e1723393951622afc401d24707a Mon Sep 17 00:00:00 2001 From: pmario Date: Thu, 25 Jan 2024 21:57:44 +0100 Subject: [PATCH] simplify docs and core texts --- core/language/en-GB/ControlPanel.multids | 5 +-- .../ControlPanel/PaletteLightDarkPicker.tid | 2 - .../features/DarkLightChangeActions.tid | 39 +++++++++++++++---- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/core/language/en-GB/ControlPanel.multids b/core/language/en-GB/ControlPanel.multids index 770e2c689..b7e3e002e 100644 --- a/core/language/en-GB/ControlPanel.multids +++ b/core/language/en-GB/ControlPanel.multids @@ -68,9 +68,8 @@ Palette/Editor/Prompt/Modified: This shadow palette has been modified Palette/Editor/Prompt: Editing Palette/Editor/Reset/Caption: reset Palette/HideEditor/Caption: hide editor -Palette/Picker/Prompt: The following settings will be used to switch between light and dark palettes.
-Palette/Picker/Prompt/Info: If the browser Light/Dark detection is activated TW will switch palettes according to the browser ''appearance'' settings. -Palette/Picker/Enable: Enable Browser Light/Dark Mode Detection +Palette/Picker/Prompt: The following settings will be used to switch between light and dark palettes.
+Palette/Picker/Enable: Enable Light/Dark Mode Handling Palette/Picker/Heading: Automatic Light/Dark Mode Configuraton Palette/Picker/ShowAllPalettes: Show all palettes Palette/Prompt: Current palette: diff --git a/core/ui/ControlPanel/PaletteLightDarkPicker.tid b/core/ui/ControlPanel/PaletteLightDarkPicker.tid index 3fbd32d42..b8125346e 100644 --- a/core/ui/ControlPanel/PaletteLightDarkPicker.tid +++ b/core/ui/ControlPanel/PaletteLightDarkPicker.tid @@ -8,8 +8,6 @@ title: $:/core/ui/ControlPanel/Palette/LightDarkConfig !! <> -<> - <$checkbox tiddler=<> field="text" checked="yes" diff --git a/editions/tw5.com/tiddlers/features/DarkLightChangeActions.tid b/editions/tw5.com/tiddlers/features/DarkLightChangeActions.tid index 4789cd0d5..410586ff9 100644 --- a/editions/tw5.com/tiddlers/features/DarkLightChangeActions.tid +++ b/editions/tw5.com/tiddlers/features/DarkLightChangeActions.tid @@ -1,9 +1,35 @@ created: 20231101120147664 -modified: 20240125155840177 +modified: 20240125202358139 tags: Features title: DarkLightChangeActions type: text/vnd.tiddlywiki +\procedure createLightDarkSwitcherTitle() _/startup/light-dark/detection + +\procedure startupLightDarkTemplate() +<$reveal type="match" stateTitle="$:/config/palette/enable-light-dark-detection" text="yes"> + <$let default={{{ [match[yes]then[$:/config/palette/default-dark]else[$:/config/palette/default-light]] }}}> + <$action-setfield $tiddler="$:/palette" text={{{ [get[text]] }}}/> + + +\end + +\procedure createLightDarkSwitcher() +<% if [!has[text]] %> +<$action-createtiddler + $basetitle=<> + text=<> + caption= "{{$:/language/ControlPanel/Palette/Config/Detection/Caption}}" + code-body= "yes" + tags= "$:/tags/DarkLightChangeActions" +/> +<$action-navigate $to=<>/> +<% else %> +<$action-navigate $to=<>/> +<% endif %> + +\end + <<.from-version "5.3.4">> Actions tagged <> are executed whenever the browser or OS dark / light setting is changed. <<.tip """Be aware that the browser setting can be independent from the OS setting.
@@ -27,14 +53,13 @@ The following variable is defined for all actions DarkLightChangeActions The following example defines the $:/palette tiddler based on the dark / light mode setting. Palettes are tagged: <> -- The tag-pill dropdown can be used to see all possible palette tiddlers. +<$button actions=<> >Create <> tiddler + ``` title: _/startup/light-dark/detection caption: {{$:/language/ControlPanel/Palette/Config/Detection/Caption}} +code-body: yes tags: $:/tags/DarkLightChangeActions - -<$reveal type="match" stateTitle="$:/config/palette/enable-light-dark-detection" text="yes"> - <$let default={{{ [match[yes]then[$:/config/palette/default-dark]else[$:/config/palette/default-light]] }}}> - <$action-setfield $tiddler="$:/palette" text={{{ [get[text]] }}}/> - - ``` + +
<$transclude $variable="startupLightDarkTemplate" $mode=block $output="text/plain" $type="text/plain" />
\ No newline at end of file