1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-11 09:50:27 +00:00
TiddlyWiki5/core/wiki/functions/themes.tid

52 lines
4.5 KiB
Plaintext
Raw Normal View History

2024-10-26 04:52:23 +00:00
title: $:/core/functions/themes
tags: $:/tags/Global
2024-10-26 17:46:55 +00:00
\function is.pixel.value(value) [<value>removesuffix[px]]
\function is.percentage.value(value) [<value>removesuffix[%]]
\function is.cm.value(value) [<value>removesuffix[cm]]
\function is.mm.value(value) [<value>removesuffix[mm]]
\function is.Q.value(value) [<value>removesuffix[Q]]
\function is.in.value(value) [<value>removesuffix[in]]
\function is.pc.value(value) [<value>removesuffix[pc]]
\function is.pt.value(value) [<value>removesuffix[pt]]
\function is.em.value(value) [<value>removesuffix[em]]
2024-10-26 18:06:14 +00:00
\function convert.to.cm(value) [<value>divide[37.8]]
\function convert.to.mm(value) [convert.to.cm<value>multiply[10]]
\function convert.to.Q(value) [convert.to.cm<value>multiply[40]]
\function convert.to.in(value) [<value>divide[96]]
\function convert.to.pc(value) [convert.to.in<value>multiply[6]]
\function convert.to.pt(value) [convert.to.in<value>multiply[72]]
\function convert.to.em(value) [<value>divide{$:/themes/tiddlywiki/vanilla/metrics/fontsize}]
2024-10-26 17:46:55 +00:00
\function convert.to.pixels(value,metric) [<metric>match[cm]then<value>multiply[37.8]] [<metric>match[mm]then<value>multiply[37.8]divide[10]] [<metric>match[Q]then<value>multiply[37.8]divide[40]] [<metric>match[in]then<value>multiply[96]] [<metric>match[pc]then<value>multiply[96]divide[6]] [<metric>match[pt]then<value>multiply[96]divide[72]] [<metric>match[em]then<value>multiply{$:/themes/tiddlywiki/vanilla/metrics/fontsize}]
\function subtract.one.from.sidebarbreakpoint(value) [is.pixel.value<value>subtract[1]addsuffix[px]] :else[is.cm.value<value>function[convert.to.pixels],<value>,[cm]subtract[1]divide[37.8]addsuffix[cm]] :else[is.mm.value<value>function[convert.to.pixels],<value>,[mm]subtract[1]divide[37.8]multiply[10]addsuffix[mm]] :else[is.Q.value<value>function[convert.to.pixels],<value>,[Q]subtract[1]divide[37.8]multiply[40]addsuffix[Q]] :else[is.in.value<value>function[convert.to.pixels],<value>,[in]subtract[1]divide[96]addsuffix[in]] :else[is.pc.value<value>function[convert.to.pixels],<value>,[pc]subtract[1]divide[96]multiply[6]addsuffix[pc]] :else[is.pt.value<value>function[convert.to.pixels],<value>,[pt]subtract[1]divide[96]multiply[72]addsuffix[pt]] :else[is.em.value<value>function[convert.to.pixels],<value>,[em]subtract[1]divide{$:/themes/tiddlywiki/vanilla/metrics/fontsize}addsuffix[em]]
\function sidebarbreakpoint() [{$:/themes/tiddlywiki/vanilla/metrics/sidebarbreakpoint}]
\function sidebarbreakpoint-minus-one() [function[subtract.one.from.sidebarbreakpoint],<sidebarbreakpoint>] :else[<sidebarbreakpoint>]
2024-10-26 09:23:14 +00:00
\function get.base.theme.metric.recursive(theme,metric) [<theme>get[dependents]enlist-input[]] :map[function[get.base.theme.metric],<currentTiddler>,<metric>]
2024-10-26 04:52:23 +00:00
\function get.base.theme.metric(theme,metric) [<theme>addsuffix[/metrics/]addsuffix<metric>!is[missing]] :else[<theme>addsuffix[/metrics/]addsuffix<metric>is[shadow]] :else[function[get.base.theme.metric.recursive],<theme>,<metric>]
2024-10-26 09:23:14 +00:00
\function get.base.theme(theme,metric) [function[get.base.theme.metric],<theme>,<metric>first[]removesuffix<metric>removesuffix[/metrics/]]
2024-10-26 04:52:23 +00:00
\function get.theme.metric(metric) [function[get.base.theme.metric],{$:/theme},<metric>first[]get[text]]
2024-10-26 09:23:14 +00:00
\function get.base.theme.option.recursive(theme,option) [<theme>get[dependents]enlist-input[]] :map[function[get.base.theme.option],<currentTiddler>,<option>]
2024-10-26 06:13:14 +00:00
\function get.base.theme.option(theme,option) [<theme>addsuffix[/options/]addsuffix<option>!is[missing]] :else[<theme>addsuffix[/options/]addsuffix<option>is[shadow]] :else[function[get.base.theme.option.recursive],<theme>,<option>]
\function get.theme.option(option) [function[get.base.theme.option],{$:/theme},<option>first[]get[text]]
2024-10-26 04:52:23 +00:00
\function get.theme(metric) [function[get.base.theme],{$:/theme},<metric>addsuffix[/metrics/]addsuffix<metric>!is[missing]] :else[function[get.base.theme],{$:/theme},<metric>addsuffix[/metrics/]addsuffix<metric>is[shadow]] :else[[$:/themes/tiddlywiki/vanilla/metrics/]addsuffix<metric>]
\function set.theme.metric(metric) [function[get.base.theme.metric],{$:/theme},<metric>first[]is[shadow]] :else[function[get.base.theme.metric],{$:/theme},<metric>first[]!is[shadow]!is[missing]] :else[[$:/themes/tiddlywiki/vanilla/metrics/]addsuffix<metric>]
2024-10-26 04:52:23 +00:00
2024-10-26 09:23:14 +00:00
\function get.base.functions.theme.recursive(theme) [<theme>get[dependents]enlist-input[]] :map[function[get.base.functions.theme],<currentTiddler>]
2024-10-26 04:52:23 +00:00
\function get.base.functions.theme(theme) [<theme>addsufix[/functions]!is[missing]] :else[<theme>addsuffix[/functions]is[shadow]] :else[function[get.base.functions.theme.recursive],<theme>]