simplify docs and core texts

This commit is contained in:
pmario 2024-01-25 21:57:44 +01:00
parent 106efe9775
commit 3470c6b8d7
3 changed files with 34 additions and 12 deletions

View File

@ -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.<br><ul><li>The defaults can be changed using the palette {{$:/core/images/palette|16px}} button</li><li>For testing -- the palette-previews can be manually selected. (Will be changed by the browser if needed)</li></ul>
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.<br><ul><li>The defaults can be changed using the palette {{$:/core/images/palette|16px}} button</li><li>Select a palette-preview to activate it.</li><li>Automatic selection can be configured using [[custom actions|DarkLightChangeActions]]. See: [[DarkLightChangeActions|https://tiddlywiki.com/#DarkLightChangeActions]]</li></ul>
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:

View File

@ -8,8 +8,6 @@ title: $:/core/ui/ControlPanel/Palette/LightDarkConfig
!! <<lingo "Picker/Heading">>
<<lingo "Picker/Prompt/Info">>
<$checkbox tiddler=<<config-dark-light>>
field="text"
checked="yes"

View File

@ -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={{{ [<dark-mode>match[yes]then[$:/config/palette/default-dark]else[$:/config/palette/default-light]] }}}>
<$action-setfield $tiddler="$:/palette" text={{{ [<default>get[text]] }}}/>
</$let>
</$reveal>
\end
\procedure createLightDarkSwitcher()
<% if [<createLightDarkSwitcherTitle>!has[text]] %>
<$action-createtiddler
$basetitle=<<createLightDarkSwitcherTitle>>
text=<<startupLightDarkTemplate>>
caption= "{{$:/language/ControlPanel/Palette/Config/Detection/Caption}}"
code-body= "yes"
tags= "$:/tags/DarkLightChangeActions"
/>
<$action-navigate $to=<<createLightDarkSwitcherTitle>>/>
<% else %>
<$action-navigate $to=<<createLightDarkSwitcherTitle>>/>
<% endif %>
\end
<<.from-version "5.3.4">> Actions tagged <<tag "$:/tags/DarkLightChangeActions">> 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.<br>
@ -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: <<tag "$:/tags/Palette">> -- The tag-pill dropdown can be used to see all possible palette tiddlers.
<$button actions=<<createLightDarkSwitcher>> >Create <<createLightDarkSwitcherTitle>> tiddler</$button>
```
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={{{ [<dark-mode>match[yes]then[$:/config/palette/default-dark]else[$:/config/palette/default-light]] }}}>
<$action-setfield $tiddler="$:/palette" text={{{ [<default>get[text]] }}}/>
</$let>
</$reveal>
```
<pre><code><$transclude $variable="startupLightDarkTemplate" $mode=block $output="text/plain" $type="text/plain" /></code></pre>