Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/text editor: extend the adaptive color support for tables
Adorian Doran9be31f3c7239
diff --git a/apps/client/src/widgets/type_widgets/text/font_colors.spec.ts b/apps/client/src/widgets/type_widgets/text/color_palette.spec.tssimilarity index 64%rename from apps/client/src/widgets/type_widgets/text/font_colors.spec.tsrename to apps/client/src/widgets/type_widgets/text/color_palette.spec.tsindex dc1e64318e..b116beb7b5 100644--- a/apps/client/src/widgets/type_widgets/text/font_colors.spec.ts+++ b/apps/client/src/widgets/type_widgets/text/color_palette.spec.ts@@ -2,21 +2,22 @@ import { adaptColor, HIGHLIGHT_BACKGROUND } from "@triliumnext/commons";import { describe, expect, it, vi } from "vitest";import { DEFAULT_COLOR_PALETTE } from "../../react/ColorPicker.js";-import { buildFontColorConfig } from "./font_colors.js";+import { buildFontColorConfig, buildTableColorConfig } from "./color_palette.js";vi.mock("../../../services/i18n.js", () => ({ t: (key: string) => key }));const SOURCES = [ "#000000", "#555555", "#aaaaaa", "#ffffff", ...DEFAULT_COLOR_PALETTE ];+const LABELS = [+ "Black", "Dim grey", "Light grey", "White",+ "Red", "Orange", "Yellow", "Light green", "Green", "Aquamarine", "Turquoise",+ "Light blue", "Blue", "Purple", "text-editor.colors.pink"+];describe("buildFontColorConfig", () => {it("lists four greys, then every note color hue, four to a row", () => {for (const palette of Object.values(buildFontColorConfig())) {expect(palette.columns).toBe(4);- expect(palette.colors.map(({ label }) => label)).toEqual([- "Black", "Dim grey", "Light grey", "White",- "Red", "Orange", "Yellow", "Light green", "Green", "Aquamarine", "Turquoise",- "Light blue", "Blue", "Purple", "text-editor.colors.pink"- ]);+ expect(palette.colors.map(({ label }) => label)).toEqual(LABELS);}});@@ -38,3 +39,16 @@ describe("buildFontColorConfig", () => {expect(colors.find(({ label }) => label === "Yellow")?.color).toBe(HIGHLIGHT_BACKGROUND);});});++describe("buildTableColorConfig", () => {+ it("gives table and cell borders and backgrounds the same swatches, as plain colors", () => {+ const { tableProperties, tableCellProperties } = buildTableColorConfig();+ for (const colors of [+ tableProperties.borderColors, tableProperties.backgroundColors,+ tableCellProperties.borderColors, tableCellProperties.backgroundColors+ ]) {+ expect(colors.map(({ label }) => label)).toEqual(LABELS);+ expect(colors.map(({ color }) => color)).toEqual(SOURCES);+ }+ });+});diff --git a/apps/client/src/widgets/type_widgets/text/font_colors.ts b/apps/client/src/widgets/type_widgets/text/color_palette.tssimilarity index 59%rename from apps/client/src/widgets/type_widgets/text/font_colors.tsrename to apps/client/src/widgets/type_widgets/text/color_palette.tsindex 1e690be1b3..c6d5919f78 100644--- a/apps/client/src/widgets/type_widgets/text/font_colors.ts+++ b/apps/client/src/widgets/type_widgets/text/color_palette.ts@@ -9,8 +9,20 @@ import { DEFAULT_COLOR_PALETTE } from "../../react/ColorPicker.js";*/export function buildFontColorConfig() {return {- fontColor: buildPalette("text"),- fontBackgroundColor: buildPalette("background")+ fontColor: { colors: buildAdaptedSwatches("text"), columns: 4 },+ fontBackgroundColor: { colors: buildAdaptedSwatches("background"), columns: 4 }+ };+}++/**+ * The same swatches for the table and cell properties, as plain colors: the table dialogs reject a+ * `light-dark()` value, so `AdaptiveColors` turns the color into a pair when it is applied.+ */+export function buildTableColorConfig() {+ const colors = buildSwatches();+ return {+ tableProperties: { borderColors: colors, backgroundColors: colors },+ tableCellProperties: { borderColors: colors, backgroundColors: colors }};}@@ -27,16 +39,15 @@ const HUE_LABELS = ["Blue", "Purple"];-function buildPalette(role: AdaptiveColorRole) {+function buildAdaptedSwatches(role: AdaptiveColorRole) {+ return buildSwatches().map((swatch) => ({ ...swatch, color: adaptColor(swatch.color, role) }));+}++function buildSwatches() {// CKEditor has no name for pink, so it comes from the app's own catalogue.const hueLabels = [ ...HUE_LABELS, t("text-editor.colors.pink") ];- const swatches = [+ return [...GREYS,...DEFAULT_COLOR_PALETTE.map((color, index) => ({ color, label: hueLabels[index] }))];-- return {- colors: swatches.map((swatch) => ({ ...swatch, color: adaptColor(swatch.color, role) })),- columns: 4- };}diff --git a/apps/client/src/widgets/type_widgets/text/config.ts b/apps/client/src/widgets/type_widgets/text/config.tsindex 87749ebb23..9ab5bf598a 100644--- a/apps/client/src/widgets/type_widgets/text/config.ts+++ b/apps/client/src/widgets/type_widgets/text/config.ts@@ -18,7 +18,7 @@ import { resolveContentLanguage } from "../../../utils/formatters.js";import SAMPLE_DIAGRAMS from "../mermaid/sample_diagrams.js";import buildAiAssistantStream, { type AiNoteLocationProvider, buildAiAssistantQuickActions } from "./ai_assistant_stream.js";import diffAiResponse from "./ai_diff.js";-import { buildFontColorConfig } from "./font_colors.js";+import { buildFontColorConfig, buildTableColorConfig } from "./color_palette.js";import { buildQuoteTransformation, resolveQuoteSetting } from "./quotes.js";import { buildCustomTransformations, parseCustomReplacements } from "./replacements.js";import { buildToolbarConfig } from "./toolbar.js";@@ -150,7 +150,8 @@ export async function buildConfig(opts: BuildEditorOptions): Promise<EditorConficontentToolbar: ["tableColumn", "tableRow", "mergeTableCells", "tableSort", "tableProperties","tableCellProperties", "toggleTableCaption"- ]+ ],+ ...buildTableColorConfig()},list: {properties: {diff --git a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Tables.html b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Tables.htmlindex e85b531f8f..88afde328a 100644--- a/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Tables.html+++ b/apps/server/src/assets/doc_notes/en/User Guide/User Guide/Note Types/Text/Tables.html@@ -334,6 +334,17 @@ src="3_Tables_image.png" width="384" height="100"></ul><p>The cell will immediately update to reflect the changes, but the <em>Save</em> buttonmust be pressed for the changes to persist.</p>+<h2>Border and background colors</h2>+<p>The border and background colors of tables and cells adapt to the <a href="#root/_help_Wy267RK4M69c">theme</a>,+ the same way as <a href="#root/_help_Gr6xFaF6ioJ5">text colors</a> do. A+ color picked from the palette, chosen with the color picker or typed in+ is saved in two shades, one for light themes and one for dark themes, so+ borders stay visible and text stays readable on the background in both.+ The hue stays the same.</p>+<p>Once a color is applied, its field shows the saved value as <code>light-dark(…)</code>.+ To change the color, pick or type a new one.</p>+<p>Colors applied with older versions of Trilium are kept exactly as they+ are, until a new color is applied.</p><h2>Caption</h2><p>Press the <span class="tn-icon cke cke-caption"></span> button toinsert a caption or a text description of the table, which is going todiff --git a/docs/User Guide/User Guide/Note Types/Text/Tables.md b/docs/User Guide/User Guide/Note Types/Text/Tables.mdindex 0fe8bd9903..cce325efed 100644--- a/docs/User Guide/User Guide/Note Types/Text/Tables.md+++ b/docs/User Guide/User Guide/Note Types/Text/Tables.md@@ -169,6 +169,14 @@ The following options can be adjusted:The cell will immediately update to reflect the changes, but the _Save_ button must be pressed for the changes to persist.+## Border and background colors++The border and background colors of tables and cells adapt to the [theme](../../Basic%20Concepts%20and%20Features/Themes.md), the same way as [text colors](General%20formatting.md) do. A color picked from the palette, chosen with the color picker or typed in is saved in two shades, one for light themes and one for dark themes, so borders stay visible and text stays readable on the background in both. The hue stays the same.++Once a color is applied, its field shows the saved value as `light-dark(…)`. To change the color, pick or type a new one.++Colors applied with older versions of Trilium are kept exactly as they are, until a new color is applied.+## CaptionPress the <span class="tn-icon cke cke-caption"></span> button to insert a caption or a text description of the table, which is going to be displayed above the table.diff --git a/packages/ckeditor5/src/plugins.ts b/packages/ckeditor5/src/plugins.tsindex f6fa129f33..df1a4e52cd 100644--- a/packages/ckeditor5/src/plugins.ts+++ b/packages/ckeditor5/src/plugins.ts@@ -37,7 +37,7 @@ import CopyLinkUrlButton from "./plugins/copy_link_url.js";import ImageActions from "./plugins/image_actions.js";import ClipboardBareImage from "./plugins/clipboard_bare_image.js";import ClipboardImageEmbed from "./plugins/clipboard_image_embed.js";-import AdaptiveFontColor from "./plugins/adaptive_font_color.js";+import AdaptiveColors from "./plugins/adaptive_colors.js";import TriliumSnippets from "./plugins/snippets/snippets.js";import TriliumAiAssistant from "./plugins/ai_assistant/ai_assistant.js";@@ -112,7 +112,7 @@ const TRILIUM_PLUGINS: typeof Plugin[] = [ImageActions,ClipboardImageEmbed,ClipboardBareImage,- AdaptiveFontColor,+ AdaptiveColors,TriliumSnippets,TriliumAiAssistant,FindInLinkWidgets,diff --git a/packages/ckeditor5/src/plugins/adaptive_font_color.spec.ts b/packages/ckeditor5/src/plugins/adaptive_colors.spec.tssimilarity index 52%rename from packages/ckeditor5/src/plugins/adaptive_font_color.spec.tsrename to packages/ckeditor5/src/plugins/adaptive_colors.spec.tsindex e5b3d44685..4cdb4bc46d 100644--- a/packages/ckeditor5/src/plugins/adaptive_font_color.spec.ts+++ b/packages/ckeditor5/src/plugins/adaptive_colors.spec.ts@@ -6,24 +6,28 @@ import {Essentials,FontBackgroundColor,FontColor,- Paragraph+ Paragraph,+ Table,+ TableCellProperties,+ TableProperties} from "ckeditor5";import { beforeEach, describe, expect, it } from "vitest";import { createTestEditor } from "../../test/editor-kit.js";-import AdaptiveFontColor from "./adaptive_font_color.js";+import AdaptiveColors from "./adaptive_colors.js";-describe("AdaptiveFontColor", () => {+describe("AdaptiveColors", () => {let editor: ClassicEditor;beforeEach(async () => {editor = await createTestEditor([- Essentials, Paragraph, FontColor, FontBackgroundColor, AdaptiveFontColor+ Essentials, Paragraph, FontColor, FontBackgroundColor, Table, TableProperties,+ TableCellProperties, AdaptiveColors]);setModelData(editor.model, "<paragraph>[text]</paragraph>");});- it("stores a picked color as a light and dark theme pair", () => {+ it("stores a picked text color as a light and dark theme pair", () => {editor.execute("fontColor", { value: "hsl(0, 75%, 60%)" });editor.execute("fontBackgroundColor", { value: "hsl(60,75%,60%)" });@@ -36,7 +40,7 @@ describe("AdaptiveFontColor", () => {);});- it("keeps a pair through saving and loading the note", () => {+ it("keeps a text color pair through saving and loading the note", () => {editor.execute("fontColor", { value: "#e64d4d" });const saved = editor.getData();expect(saved).toContain(`color:${adaptColor("#e64d4d", "text")}`);@@ -55,4 +59,27 @@ describe("AdaptiveFontColor", () => {expect(getModelData(editor.model, { withoutSelection: true })).toBe("<paragraph>text</paragraph>");});++ it("stores table and cell colors as pairs, through saving and loading", () => {+ setModelData(editor.model, "<table><tableRow><tableCell><paragraph>[]a</paragraph>"+ + "</tableCell></tableRow></table>");+ editor.execute("tableBorderStyle", { value: "solid" });+ editor.execute("tableBorderWidth", { value: "2px" });+ editor.execute("tableBorderColor", { value: "#4d99e6" });+ editor.execute("tableBackgroundColor", { value: "#e5e64d" });+ editor.execute("tableCellBorderStyle", { value: "dashed" });+ editor.execute("tableCellBorderWidth", { value: "1px" });+ editor.execute("tableCellBorderColor", { value: "#000000" });+ editor.execute("tableCellBackgroundColor", { value: "#e64d4d" });++ const saved = editor.getData();+ expect(saved).toContain(`border:2px solid ${adaptColor("#4d99e6", "tableBorder")}`);+ expect(saved).toContain(`background-color:${adaptColor("#e5e64d", "tableBackground")}`);+ // 1px is the default cell border width, so the cell gets no `border` shorthand.+ expect(saved).toContain(`border-color:${adaptColor("#000000", "tableBorder")}`);+ expect(saved).toContain(`background-color:${adaptColor("#e64d4d", "tableBackground")}`);++ editor.setData(saved);+ expect(editor.getData()).toBe(saved);+ });});diff --git a/packages/ckeditor5/src/plugins/adaptive_colors.ts b/packages/ckeditor5/src/plugins/adaptive_colors.tsnew file mode 100644index 0000000000..45f58fae76--- /dev/null+++ b/packages/ckeditor5/src/plugins/adaptive_colors.ts@@ -0,0 +1,45 @@+import { adaptColor, type AdaptiveColorRole } from "@triliumnext/commons";+import { type CommandExecuteEvent, Plugin } from "ckeditor5";++/**+ * Stores the colors of text and tables as a light and dark theme pair (see `adaptColor`), whether+ * they come from a palette swatch, the color picker, the document colors or a typed value.+ */+export default class AdaptiveColors extends Plugin {++ static get pluginName() {+ return "AdaptiveColors" as const;+ }++ afterInit() {+ for (const [ commandName, role ] of Object.entries(COMMAND_ROLES)) {+ this.adaptCommandValue(commandName, role);+ }+ }++ private adaptCommandValue(commandName: string, role: AdaptiveColorRole) {+ // An editor without the table properties plugins has no table color commands.+ const command = this.editor.commands.get(commandName);+ if (!command) {+ return;+ }++ this.listenTo<CommandExecuteEvent>(command, "execute", (_eventInfo, args) => {+ const options = args[0] as { value?: unknown } | undefined;+ if (typeof options?.value === "string" && options.value) {+ args[0] = { ...options, value: adaptColor(options.value, role) };+ }+ }, { priority: "high" });+ }++}++/** The color commands, and what their color paints. */+const COMMAND_ROLES: Record<string, AdaptiveColorRole> = {+ fontColor: "text",+ fontBackgroundColor: "background",+ tableBorderColor: "tableBorder",+ tableCellBorderColor: "tableBorder",+ tableBackgroundColor: "tableBackground",+ tableCellBackgroundColor: "tableBackground"+};diff --git a/packages/ckeditor5/src/plugins/adaptive_font_color.ts b/packages/ckeditor5/src/plugins/adaptive_font_color.tsdeleted file mode 100644index f01d951601..0000000000--- a/packages/ckeditor5/src/plugins/adaptive_font_color.ts+++ /dev/null@@ -1,43 +0,0 @@-import { adaptColor, type AdaptiveColorRole } from "@triliumnext/commons";-import {- type CommandExecuteEvent,- FontBackgroundColorEditing,- FontColorEditing,- Plugin-} from "ckeditor5";--/**- * Stores Font Color and Font Background Color as a light and dark theme pair (see `adaptColor`),- * whether the color comes from a palette swatch, the color picker or the document colors.- */-export default class AdaptiveFontColor extends Plugin {-- static get requires() {- return [ FontColorEditing, FontBackgroundColorEditing ] as const;- }-- static get pluginName() {- return "AdaptiveFontColor" as const;- }-- init() {- this.adaptCommandValue("fontColor", "text");- this.adaptCommandValue("fontBackgroundColor", "background");- }-- private adaptCommandValue(commandName: string, role: AdaptiveColorRole) {- const command = this.editor.commands.get(commandName);- /* v8 ignore next 3 -- the required editing plugins register both commands. */- if (!command) {- return;- }-- this.listenTo<CommandExecuteEvent>(command, "execute", (_eventInfo, args) => {- const options = args[0] as { value?: string } | undefined;- if (options?.value) {- args[0] = { ...options, value: adaptColor(options.value, role) };- }- }, { priority: "high" });- }--}diff --git a/packages/commons/src/lib/adaptive_color.spec.ts b/packages/commons/src/lib/adaptive_color.spec.tsindex 60c6a2caf8..c4080dd6bd 100644--- a/packages/commons/src/lib/adaptive_color.spec.ts+++ b/packages/commons/src/lib/adaptive_color.spec.ts@@ -40,8 +40,31 @@ describe("adaptColor", () => {}});+ it("keeps table borders visible and table backgrounds readable in both themes", () => {+ const colors = [ ...HUES, ...GREYS ];+ const text = colors.map((color) => pairOf(adaptColor(color, "text")));++ for (const theme of [ "light", "dark" ] as const) {+ const { background: page, text: defaultText } = PAGE[theme];+ for (const color of colors) {+ // 3:1 is the WCAG minimum for graphical objects.+ const border = pairOf(adaptColor(color, "tableBorder"))[theme];+ expect(contrast(border, page)).toBeGreaterThanOrEqual(3);++ const cell = pairOf(adaptColor(color, "tableBackground"))[theme];+ expect(contrast(defaultText, cell)).toBeGreaterThanOrEqual(4.5);+ for (const textPair of text) {+ expect(contrast(textPair[theme], cell)).toBeGreaterThanOrEqual(4.5);+ }+ }+ }++ // A border that is already visible in both themes keeps its color.+ expect(adaptColor("#e64d4d", "tableBorder")).toBe("light-dark(#e64d4d,#e64d4d)");+ });+it("gives each grey a shade of its own in both themes", () => {- for (const role of [ "text", "background" ] as const) {+ for (const role of [ "text", "background", "tableBorder", "tableBackground" ] as const) {const pairs = GREYS.map((grey) => pairOf(adaptColor(grey, role)));expect(new Set(pairs.map(({ light }) => light)).size).toBe(GREYS.length);expect(new Set(pairs.map(({ dark }) => dark)).size).toBe(GREYS.length);diff --git a/packages/commons/src/lib/adaptive_color.ts b/packages/commons/src/lib/adaptive_color.tsindex 6aac1923c4..fc4d8b80ae 100644--- a/packages/commons/src/lib/adaptive_color.ts+++ b/packages/commons/src/lib/adaptive_color.ts@@ -1,10 +1,13 @@-/** Whether a color is used for text (Font Color) or behind it (Font Background Color). */-export type AdaptiveColorRole = "text" | "background";+/**+ * What a color paints: text (Font Color), the background behind text (Font Background Color), or a+ * table's or cell's border or background.+ */+export type AdaptiveColorRole = "text" | "background" | "tableBorder" | "tableBackground";/**- * Turns a color into a `light-dark(#light,#dark)` pair, so text and highlights stay readable in- * both the light and the dark theme. The hue is kept; the CIELAB lightness is moved into the band- * of the role and theme, and the chroma is capped.+ * Turns a color into a `light-dark(#light,#dark)` pair, so text, highlights and tables stay+ * readable in both the light and the dark theme. The hue is kept; the CIELAB lightness is moved+ * into the band of the role and theme, and the chroma is capped.** @param color a hex, `rgb()` or `hsl()` color. Anything else, including a color that is already* a pair, is returned unchanged.@@ -30,8 +33,8 @@ interface Band {}/**- * The CIELAB lightness range and chroma cap per role and theme. The limits keep text at 4.5:1 or- * more against the Next themes' page and against every highlight.+ * The CIELAB lightness range and chroma cap per role and theme. Against the Next themes' page, the+ * limits keep text at 4.5:1 or more, also on every background, and borders at 3:1 or more.*/const BANDS: Record<AdaptiveColorRole, Record<"light" | "dark", Band>> = {text: {@@ -41,6 +44,14 @@ const BANDS: Record<AdaptiveColorRole, Record<"light" | "dark", Band>> = {background: {light: { minLightness: 90, maxLightness: 100, maxChroma: 20 },dark: { minLightness: 0, maxLightness: 30, maxChroma: 30 }+ },+ tableBorder: {+ light: { minLightness: 0, maxLightness: 60, maxChroma: Infinity },+ dark: { minLightness: 47, maxLightness: 100, maxChroma: Infinity }+ },+ tableBackground: {+ light: { minLightness: 90, maxLightness: 100, maxChroma: 20 },+ dark: { minLightness: 0, maxLightness: 30, maxChroma: 30 }}};diff --git a/packages/trilium-core/src/services/sanitizer.spec.ts b/packages/trilium-core/src/services/sanitizer.spec.tsindex 676a716b35..749970bcc4 100644--- a/packages/trilium-core/src/services/sanitizer.spec.ts+++ b/packages/trilium-core/src/services/sanitizer.spec.ts@@ -83,7 +83,18 @@ describe("sanitize", () => {// Only a pair of hex colors passes; anything else inside light-dark() is dropped.expect(sanitizeHtml(`<span style="color:light-dark(red,url(x))">x</span>`)).toBe("<span>x</span>");- expect(sanitizeHtml(`<td style="border-color:light-dark(#000000,#ffffff)">x</td>`))+ });++ it("keeps light-dark() table and cell border colors", () => {+ const pair = "light-dark(#000000,#6f6f6f)";+ const dirty = `<table style="border-color:${pair}"><tbody><tr>`+ + `<th style="border-color:${pair}">H</th>`+ + `<td style="border:1px solid ${pair}">C</td>`+ + `<td style="border-color:${pair}">D</td>`+ + "</tr></tbody></table>";+ expect(sanitizeHtml(dirty)).toBe(dirty);++ expect(sanitizeHtml(`<td style="border-color:light-dark(red,blue)">x</td>`)).not.toContain("light-dark");});diff --git a/packages/trilium-core/src/services/sanitizer.ts b/packages/trilium-core/src/services/sanitizer.tsindex a8242637b5..d6a432678b 100644--- a/packages/trilium-core/src/services/sanitizer.ts+++ b/packages/trilium-core/src/services/sanitizer.ts@@ -78,17 +78,17 @@ export function sanitizeHtml(dirtyHtml: string) {height: sizeRegex},table: {- "border-color": [...colorRegex, /^\s*transparent\s*$/],+ "border-color": [...colorRegex, adaptiveColorRegex, /^\s*transparent\s*$/],"border-style": [/^\s*(none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset)\s*$/]},td: {- "border-color": [...colorRegex, /^\s*transparent\s*$/],+ "border-color": [...colorRegex, adaptiveColorRegex, /^\s*transparent\s*$/],border: [- /^\s*\d+(?:px|em|%)\s*(none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset)\s*(#(0x)?[0-9a-fA-F]+|rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)|hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\))\s*$/+ /^\s*\d+(?:px|em|%)\s*(none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset)\s*(#(0x)?[0-9a-fA-F]+|rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)|hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\)|light-dark\(\s*#[0-9a-fA-F]{6}\s*,\s*#[0-9a-fA-F]{6}\s*\))\s*$/]},th: {- "border-color": [...colorRegex, /^\s*transparent\s*$/]+ "border-color": [...colorRegex, adaptiveColorRegex, /^\s*transparent\s*$/]},col: {width: sizeRegex