From 455249db4d02838d562892075981557bd32a1451 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Czajka?= <62751+lukaszcz@users.noreply.github.com> Date: Tue, 19 Nov 2024 20:34:52 +0100 Subject: [PATCH] HTML generation: make the light theme lighter (#3168) * Closes #3141 * Adds the `latte-light` theme with lighter background and makes it the default. This is a bit subjective, but in my opinion the light theme should not have a background darker than the browser window pane. It should be close to white. --- app/Commands/Html/Options.hs | 2 +- assets/css/latte-light.css | 30 +++++++++++++++++++ .../Compiler/Backend/Html/Data/Options.hs | 3 ++ src/Juvix/Compiler/Backend/Html/Extra.hs | 5 ++++ 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 assets/css/latte-light.css diff --git a/app/Commands/Html/Options.hs b/app/Commands/Html/Options.hs index 409fa270c4..1796e162bd 100644 --- a/app/Commands/Html/Options.hs +++ b/app/Commands/Html/Options.hs @@ -47,7 +47,7 @@ parseHtml = do (eitherReader parseTheme) ( long "theme" <> metavar "THEME" - <> value Latte + <> value LatteLight <> showDefault <> help ("Theme for syntax highlighting. " <> availableStr) <> completeWith (map show allThemes) diff --git a/assets/css/latte-light.css b/assets/css/latte-light.css new file mode 100644 index 0000000000..b7581fd5a0 --- /dev/null +++ b/assets/css/latte-light.css @@ -0,0 +1,30 @@ +/* Lighter version of the latte color palette based on https://github.com/catppuccin/catppuccin#-palette */ + +:root { + --ctp-rosewater: #dc8a78; + --ctp-flamingo: #dd7878; + --ctp-pink: #ea76cb; + --ctp-mauve: #8839ef; + --ctp-red: #d20f39; + --ctp-maroon: #e64553; + --ctp-peach: #fe640b; + --ctp-yellow: #df8e1d; + --ctp-green: #40a02b; + --ctp-teal: #179299; + --ctp-sky: #04a5e5; + --ctp-sapphire: #209fb5; + --ctp-blue: #1e66f5; + --ctp-lavender: #7287fd; + --ctp-text: #4c4f69; + --ctp-subtext1: #5c5f77; + --ctp-subtext0: #6c6f85; + --ctp-overlay2: #7c7f93; + --ctp-overlay1: #8c8fa1; + --ctp-overlay0: #9ca0b0; + --ctp-surface2: #acb0be; + --ctp-surface1: #bcc0cc; + --ctp-surface0: #ccd0da; + --ctp-base: #fbfcff; + --ctp-mantle: #f0f3f9; + --ctp-crust: #dce0e8; +} diff --git a/src/Juvix/Compiler/Backend/Html/Data/Options.hs b/src/Juvix/Compiler/Backend/Html/Data/Options.hs index fa921a9b94..e269eb0fa3 100644 --- a/src/Juvix/Compiler/Backend/Html/Data/Options.hs +++ b/src/Juvix/Compiler/Backend/Html/Data/Options.hs @@ -40,6 +40,7 @@ defaultHtmlOptions = data Theme = Nord | Macchiato + | LatteLight | Latte | Frappe | Mocha @@ -49,6 +50,7 @@ instance Show Theme where show = \case Nord -> "nord" Macchiato -> "macchiato" + LatteLight -> "latte-light" Latte -> "latte" Frappe -> "frappe" Mocha -> "mocha" @@ -62,6 +64,7 @@ themeLight :: Theme -> ThemeLight themeLight = \case Nord -> Dark Macchiato -> Dark + LatteLight -> Light Latte -> Light Frappe -> Dark Mocha -> Dark diff --git a/src/Juvix/Compiler/Backend/Html/Extra.hs b/src/Juvix/Compiler/Backend/Html/Extra.hs index b19b37732a..320b9d2d44 100644 --- a/src/Juvix/Compiler/Backend/Html/Extra.hs +++ b/src/Juvix/Compiler/Backend/Html/Extra.hs @@ -69,6 +69,9 @@ juvixNordCss = cssLink "juvix-nord.css" nordCss :: (Members '[Reader HtmlOptions] r) => Sem r Html nordCss = cssLink "nord.css" +latteLightCss :: (Members '[Reader HtmlOptions] r) => Sem r Html +latteLightCss = cssLink "latte-light.css" + latteCss :: (Members '[Reader HtmlOptions] r) => Sem r Html latteCss = cssLink "latte.css" @@ -87,6 +90,7 @@ flavourCss = do case theme of Nord -> nordCss Macchiato -> macchiatoCss + LatteLight -> latteLightCss Latte -> latteCss Frappe -> frappeCss Mocha -> mochaCss @@ -97,6 +101,7 @@ themeCss = do case theme of Nord -> juvixNordCss Macchiato -> juvixCatppuchinCss + LatteLight -> juvixCatppuchinCss Latte -> juvixCatppuchinCss Frappe -> juvixCatppuchinCss Mocha -> juvixCatppuchinCss