From 0c9211a541700d27551c35b6eb82fcfe021d4a35 Mon Sep 17 00:00:00 2001 From: Chad Miller Date: Mon, 20 May 2024 09:52:50 -0400 Subject: [PATCH 1/2] dot-rendered images transparent and shadows added Dot used to write opaque white backgrounds. Normally okay until night falls. Now, write transparent images. This sucks because the foreground is still dark. We instead use CSS drop-shadows to draw a text color around the alpha edges, thereby making black-on-black, actually black-over-white-on-black. --- src/processors.ts | 2 +- styles.css | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/processors.ts b/src/processors.ts index 70ee40d..7dd5d0c 100644 --- a/src/processors.ts +++ b/src/processors.ts @@ -22,7 +22,7 @@ export class Processors { return new Promise((resolve, reject) => { const cmdPath = this.plugin.settings.dotPath; const imageFormat = this.plugin.settings.imageFormat; - const parameters = [ `-T${imageFormat}`, sourceFile ]; + const parameters = [ `-T${imageFormat}`, `-Gbgcolor=transparent`, `-Gstylesheet=obs-gviz.css`, sourceFile ]; console.debug(`Starting dot process ${cmdPath}, ${parameters}`); const dotProcess = spawn(cmdPath, parameters); diff --git a/styles.css b/styles.css index 0f1a26b..a23960f 100644 --- a/styles.css +++ b/styles.css @@ -1,4 +1,15 @@ .d3graphvizError{ color: red; border: 1px solid red; -} \ No newline at end of file +} + +/* temporary hack until SVG loads CSS */ +.theme-dark .block-language-dot img.graphviz { + filter: + drop-shadow( 2px 2px 2px var(--text-on-accent)) + drop-shadow(-2px 2px 2px var(--text-on-accent)) + drop-shadow( 2px -2px 2px var(--text-on-accent)) + drop-shadow(-2px -2px 2px var(--text-on-accent)) + ; +} + From 56e363151b081709633b95f2a84f58c303cd3d68 Mon Sep 17 00:00:00 2001 From: Chad Miller Date: Tue, 5 Nov 2024 19:47:25 -0500 Subject: [PATCH 2/2] Use more clever inversion of colors, instead of contrasting auras --- styles.css | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/styles.css b/styles.css index a23960f..936627f 100644 --- a/styles.css +++ b/styles.css @@ -3,13 +3,7 @@ border: 1px solid red; } -/* temporary hack until SVG loads CSS */ .theme-dark .block-language-dot img.graphviz { - filter: - drop-shadow( 2px 2px 2px var(--text-on-accent)) - drop-shadow(-2px 2px 2px var(--text-on-accent)) - drop-shadow( 2px -2px 2px var(--text-on-accent)) - drop-shadow(-2px -2px 2px var(--text-on-accent)) - ; + filter: invert(100%); }