From d70b91a6c4fa002b5e5ab5e0470cdc7184599eee Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Mon, 29 Aug 2022 16:16:55 +0200 Subject: [PATCH] Dark theme related fixes --- packages/common/manifest.ts | 1 + packages/common/markdown_ext.ts | 2 ++ packages/plugs/core/core.plug.yaml | 18 ++---------- packages/web/style.ts | 2 +- packages/web/styles/theme.scss | 45 ++++++++++++++++++++++++++++-- 5 files changed, 50 insertions(+), 18 deletions(-) diff --git a/packages/common/manifest.ts b/packages/common/manifest.ts index bcd49db..139eed3 100644 --- a/packages/common/manifest.ts +++ b/packages/common/manifest.ts @@ -21,6 +21,7 @@ export type NodeDef = { firstCharacters: string[]; regex: string; styles: { [key: string]: string }; + className?: string; }; export type Manifest = plugos.Manifest & SyntaxExtensions; diff --git a/packages/common/markdown_ext.ts b/packages/common/markdown_ext.ts index 881ef2c..7ae8289 100644 --- a/packages/common/markdown_ext.ts +++ b/packages/common/markdown_ext.ts @@ -10,6 +10,7 @@ export type MDExt = { nodeType: string; tag: Tag; styles: { [key: string]: string }; + className?: string; }; export function mdExtensionSyntaxConfig({ @@ -58,6 +59,7 @@ export function loadMarkdownExtensions(system: System): MDExt[] { firstCharCodes: def.firstCharacters.map((ch) => ch.charCodeAt(0)), regex: new RegExp("^" + def.regex), styles: def.styles, + className: def.className, }); } } diff --git a/packages/plugs/core/core.plug.yaml b/packages/plugs/core/core.plug.yaml index cb287b5..8a88d44 100644 --- a/packages/plugs/core/core.plug.yaml +++ b/packages/plugs/core/core.plug.yaml @@ -4,29 +4,17 @@ syntax: firstCharacters: - "#" regex: "#[^#\\d\\s]+\\w+" - styles: - color: blue + className: sb-hashtag NakedURL: firstCharacters: - "h" regex: "https?:\\/\\/[-a-zA-Z0-9@:%._\\+~#=]{1,256}([-a-zA-Z0-9()@:%_\\+.~#?&=\\/]*)" - styles: - color: "#0330cb" - textDecoration: underline - cursor: pointer + className: sb-naked-url CommandLink: firstCharacters: - "{" regex: "\\{\\[[^\\]]+\\]\\}" - styles: - backgroundColor: "#e3dfdf" - cursor: pointer - borderTop: 1px solid silver - borderLeft: 1px solid silver - borderBottom: 1px solid gray - borderRight: 1px solid gray - borderRadius: 4px - padding: 0 4px + className: sb-command-link functions: clearPageIndex: path: "./page.ts:clearPageIndex" diff --git a/packages/web/style.ts b/packages/web/style.ts index b2785f6..3c5bb50 100644 --- a/packages/web/style.ts +++ b/packages/web/style.ts @@ -43,7 +43,7 @@ export default function highlightStyles(mdExtension: MDExt[]) { // { tag: t.content, class: "tbl-content" }, { tag: t.punctuation, class: "sb-punctuation" }, ...mdExtension.map((mdExt) => { - return { tag: mdExt.tag, ...mdExt.styles }; + return { tag: mdExt.tag, ...mdExt.styles, class: mdExt.className }; }), ]); const fn0 = hls.style; diff --git a/packages/web/styles/theme.scss b/packages/web/styles/theme.scss index 571d40f..fc974c2 100644 --- a/packages/web/styles/theme.scss +++ b/packages/web/styles/theme.scss @@ -128,6 +128,27 @@ font-size: 1.1em; } +.sb-hashtag { + color: blue; +} + +.sb-naked-url { + color: #0330cb; + text-decoration: underline; + cursor: pointer; +} + +.sb-command-link { + background-color: #e3dfdf; + cursor: pointer; + border-top: 1px solid silver; + border-left: 1px solid silver; + border-bottom: 1px solid gray; + border-right: 1px solid gray; + border-radius: 4px; + padding: 0 4px; +} + /* Color list item this way */ .sb-line-li .sb-meta { color: rgb(150, 150, 150); @@ -265,8 +286,6 @@ .sb-comment { color: #989797; - background-color: rgba(210, 210, 210, 0.2); - border-radius: 5px; font-size: 75%; line-height: 75%; } @@ -298,6 +317,16 @@ html[data-theme="dark"] { border-bottom: 1px solid #6c6c6c; } + .sb-line-li .sb-meta ~ .sb-meta, + .sb-line-fenced-code .sb-meta { + color: #d17278; + } + + .sb-wiki-link-page { + color: #7e99fc; + background-color: #a3bce712; + } + .sb-code, .sb-line-fenced-code, .sb-task-marker { @@ -308,4 +337,16 @@ html[data-theme="dark"] { border: rgb(197, 197, 197) 1px solid; background-color: #333; } + + .sb-hashtag { + color: #94b0f4; + } + + .sb-naked-url { + color: #94b0f4; + } + + .sb-command-link { + background-color: #595959; + } }