Is your feature request related to a problem? Please describe.
Back to discussion in Google forum regarding the dark/light palette, there is no way one can programmatically determine which mode dark/light is in use.
As @Jermolene advised in Google forum
If plugins want to play well with different palettes the best technique is to ensure that they exclusively use named colours via the
<<colour>>macro; that way everything will change automatically as the palette is changed.
This will solve most problems in this regard, But there may be situation where extra colors/settings are needed by plugins, so it is good to find which mode is in use and based on that, plugins can adjust their visual effects automatically!
Describe the solution you'd like
Have an extra key/value pair in the palette tiddler like mode:dark or mode:light or category:light or similar to be able to distinguish the mode of palette
@kookma - what would be the benefit of this? How could this be used? Any ideas?
best wishes
Hi @kookma I think you're suggesting a metadata field that palette authors affix to palettes to indicate whether they are "light" or "dark". That's the sort of thing we will think about for v5.1.24 when we address automatic switching of dark vs light mode. I'm inclined to think it's not necessary to have those labels as formal metadata because we need to allow users to choose to switch between any two palettes automatically. For example, I might choose a bright palette for the daytime, and a slightly subdued one for the nighttime that is actually also described as a "light" palette.
@BurningTreeC - The reason I asked this features is, some plugins like Shiraz have their own set of colors. When user switch from light palette to dark one, Shiraz still uses its light colors and user has to go to setting page and inform plugin to use its dark colors. If I can determine the mode in use by Tiddlywiki, plugin can adjust itself.
@Jermolene
I understand and I did not ask this for 5.1.23, but you are right, categorizing the palettes in dark/light or day/night may be confusing and not useful for the example just you have given above.
So, I close this issue. I think, I can have a dictionary tiddler in my plugin and categorize official palettes based on dark and light and then read the $:/palette to see what palette is in use and then determine if it is light or dark.
Thank you all.
I understand and I did not asked this for 5.1.23, but you are right, categorizing the palettes in dark/light or day/night may be confusing and not useful for the example just you have given above.
So, I close this issue. I think, I can have a dictionary tiddler in my plugin and categorize official palettes based on dark and light and then read the $:/palette to see what palette is in use and then determine if it is light or dark.
Thank you all.
Ideally, Shiraz would define the extra colours that it needs in terms of the existing named palette colours. One useful trick is the <<contrastcolour>> macro which can figure out which of two colours would provide the best contrast with the target colour. So, for example, if you need a background colour that will work regardless of the selected "foreground" colour being used for text, you might pass in black and white, and have the macro choose the one that has the highest contrast with the foreground colour.
I'm also tempted for v5.1.24 to incorporate a colour mixing library so that one could do things like {{{ [<colour foreground>colour:brightness[100%]] }}} to adjust the parameters of a colour, or mix colours, or generate a smooth gradient.
@Jermolene - many thanks for help.
I see we will have amazing features on colors in TW 5.1.24
I'm also tempted for v5.1.24 to incorporate a colour mixing library so that one could do things like
{{{ [<colour foreground>colour:brightness[100%]] }}}to adjust the parameters of a colour, or mix colours, or generate a smooth gradient.
@Jermolene one of the tricks I used for the row background colours for the import table was adding an alpha value to existing palette colours to change their transparency. A macro to make that more user-friendly would be great indeed.
See https://github.com/Jermolene/TiddlyWiki5/blob/master/themes/tiddlywiki/vanilla/base.tid#L2152
@Jermolene one of the tricks I used for the row background colours for the import table was adding an alpha value to existing palette colours to change their transparency. A macro to make that more user-friendly would be great indeed.
See https://github.com/Jermolene/TiddlyWiki5/blob/master/themes/tiddlywiki/vanilla/base.tid#L2152
I hadn't noticed that 馃憦 very cool.
It would certainly be nice to be able to do it more robustly (this technique will fail if the colour in the palette is specified with three hex digits eg #fff).
@Jermolene yes, I considered using filters to convert three hex digits to 6 etc but went the simple route for now. My goal was to avoid adding extra palette entries that we would then be stuck with moving forwards.
I've created a ticket to remind us to add tools for color/palette manipulation:
Most helpful comment
I hadn't noticed that 馃憦 very cool.
It would certainly be nice to be able to do it more robustly (this technique will fail if the colour in the palette is specified with three hex digits eg
#fff).