1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-24 07:56:52 +00:00

Add a primitive custom palette editor

This commit is contained in:
Jeremy Ruston 2025-01-02 17:10:51 +00:00
parent b90b449ceb
commit c02c82557b
3 changed files with 25 additions and 0 deletions

View File

@ -5,6 +5,7 @@ tags: $:/tags/Palette
type: application/x-tiddler-dictionary
color-scheme: light
palette-type: modern
editor: $:/palette-editors/TwentyTwenties
# Background and foreground colours, which are interpolated as required
base-paper: #FCFFF0

View File

@ -0,0 +1,18 @@
title: $:/palette-editors/TwentyTwenties
\procedure actionsRecompilePalette()
<$transclude $variable="actions-compile-palette" inputTitle={{$:/palette}} outputTitle="$:/temp/palette-colours"/>
\end actionsRecompilePalette
paper: <$edit-text tiddler={{$:/palette}} index="base-paper" type="color" tag="input" inputActions=<<actionsRecompilePalette>>/>
background: <$edit-text tiddler={{$:/palette}} index="base-background" type="color" tag="input" inputActions=<<actionsRecompilePalette>>/>
ink: <$edit-text tiddler={{$:/palette}} index="base-ink" type="color" tag="input" inputActions=<<actionsRecompilePalette>>/>
primary: <$edit-text tiddler={{$:/palette}} index="base-primary" type="color" tag="input" inputActions=<<actionsRecompilePalette>>/>
secondary: <$edit-text tiddler={{$:/palette}} index="base-secondary" type="color" tag="input" inputActions=<<actionsRecompilePalette>>/>
tertiary: <$edit-text tiddler={{$:/palette}} index="base-tertiary" type="color" tag="input" inputActions=<<actionsRecompilePalette>>/>

View File

@ -6,6 +6,12 @@ caption: {{$:/language/ControlPanel/Palette/Caption}}
{{$:/snippets/paletteswitcher}}
<$let paletteEditor={{{ [{$:/palette}get[editor]] :else[{$:/palette}get[palette-import]!match[]get[editor]] }}}>
<%if [<paletteEditor>!match[]] %>
<$transclude $tiddler=<<paletteEditor>> $mode="block"/>
<%endif%>
</$let>
<$reveal type="nomatch" state="$:/state/ShowPaletteEditor" text="yes">
<$button set="$:/state/ShowPaletteEditor" setTo="yes"><<lingo ShowEditor/Caption>></$button>