From 7acf913ebc69e7838378200dc654ef1e6bafa507 Mon Sep 17 00:00:00 2001 From: uncenter <47499684+uncenter@users.noreply.github.com> Date: Tue, 24 Dec 2024 16:45:33 -0500 Subject: [PATCH] refactor(treewide): cleanup and use rgbify mixin (#1511) --- docs/SUMMARY.md | 2 +- docs/guide/README.md | 2 +- docs/guide/raw-color-values.md | 29 ++++++++++++++++ docs/guide/rgb-values.md | 9 ----- styles/amplenote/catppuccin.user.css | 2 +- styles/anilist/catppuccin.user.css | 2 +- styles/chatgpt/catppuccin.user.css | 2 +- styles/crates.io/catppuccin.user.css | 2 +- styles/elk/catppuccin.user.css | 42 +++++++---------------- styles/google-drive/catppuccin.user.css | 8 ++--- styles/google-gemini/catppuccin.user.css | 2 +- styles/google/catppuccin.user.css | 10 +++--- styles/instagram/catppuccin.user.css | 2 +- styles/lastfm/catppuccin.user.css | 2 +- styles/lemmy/catppuccin.user.css | 2 +- styles/mdbook/catppuccin.user.css | 2 +- styles/namemc/catppuccin.user.css | 8 ++--- styles/nitter/catppuccin.user.css | 2 +- styles/ollama/catppuccin.user.css | 2 +- styles/perplexity/catppuccin.user.css | 2 +- styles/pronouns.cc/catppuccin.user.css | 2 +- styles/pronouns.page/catppuccin.user.css | 2 +- styles/stack-overflow/catppuccin.user.css | 2 +- styles/substack/catppuccin.user.css | 2 +- styles/trinket/catppuccin.user.css | 2 +- styles/vercel/catppuccin.user.css | 2 +- styles/whatsapp-web/catppuccin.user.css | 2 +- 27 files changed, 76 insertions(+), 72 deletions(-) create mode 100644 docs/guide/raw-color-values.md delete mode 100644 docs/guide/rgb-values.md diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index eb63bb83..ad0f4c3c 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -16,7 +16,7 @@ - [Images and SVGs](./guide/images-and-svgs.md) - [Syntax highlighting](./guide/syntax-highlighting.md) - - [Extracting RGB values](./guide/rgb-values.md) + - [Obtaining raw color values](./guide/raw-color-values.md) - [Tutorials](./tutorials/README.md) diff --git a/docs/guide/README.md b/docs/guide/README.md index 509e4987..66c95686 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -4,4 +4,4 @@ - [Images and SVGs](./images-and-svgs.md) - [Syntax highlighting](./syntax-highlighting.md) -- [Extracting RGB values](./rgb-values.md) +- [Obtaining raw color values](./raw-color-values.md) diff --git a/docs/guide/raw-color-values.md b/docs/guide/raw-color-values.md new file mode 100644 index 00000000..f17d001b --- /dev/null +++ b/docs/guide/raw-color-values.md @@ -0,0 +1,29 @@ +## Obtaining RGB values + +You can use the following snippet to get the raw RGB values from a color. + +```less +#rgbify(@color) { + @rgb: red(@color), green(@color), blue(@color); +} +``` + +```less +--ctp-base: #rgbify(@base) []; // -> 30, 30, 46 +``` + +## Obtaining HSL values + +You can use the following snippet to get the raw HSL values from a color. + +```less +#hslify(@color) { + @raw: e( + %("%s, %s%, %s%", hue(@color), saturation(@color), lightness(@color)) + ); +} +``` + +```less +--ctp-base: #hslify(@base) []; // -> 240, 21.052631578947366%, 14.901960784313726% +``` diff --git a/docs/guide/rgb-values.md b/docs/guide/rgb-values.md deleted file mode 100644 index d5512641..00000000 --- a/docs/guide/rgb-values.md +++ /dev/null @@ -1,9 +0,0 @@ -You can use the following snippet to get the raw RGB values from a color. - -```less -#rgbify(@color) { - @rgb-raw: red(@color), green(@color), blue(@color); -} - ---ctp-base: #rgbify(@base) []; // -> 30, 30, 46 -``` diff --git a/styles/amplenote/catppuccin.user.css b/styles/amplenote/catppuccin.user.css index d2dc2101..028b939e 100644 --- a/styles/amplenote/catppuccin.user.css +++ b/styles/amplenote/catppuccin.user.css @@ -235,7 +235,7 @@ } #rgbify(@color) { - @rgb-raw: red(@color), green(@color), blue(@color); + @rgb: red(@color), green(@color), blue(@color); } /* prettier-ignore */ diff --git a/styles/anilist/catppuccin.user.css b/styles/anilist/catppuccin.user.css index ce6218b3..694f65dc 100644 --- a/styles/anilist/catppuccin.user.css +++ b/styles/anilist/catppuccin.user.css @@ -746,7 +746,7 @@ } #rgbify(@color) { - @rgb-raw: red(@color), green(@color), blue(@color); + @rgb: red(@color), green(@color), blue(@color); } /* prettier-ignore */ diff --git a/styles/chatgpt/catppuccin.user.css b/styles/chatgpt/catppuccin.user.css index 4e57d6f9..c73a4b24 100644 --- a/styles/chatgpt/catppuccin.user.css +++ b/styles/chatgpt/catppuccin.user.css @@ -1228,7 +1228,7 @@ } #rgbify(@color) { - @rgb-raw: red(@color), green(@color), blue(@color); + @rgb: red(@color), green(@color), blue(@color); } /* prettier-ignore */ diff --git a/styles/crates.io/catppuccin.user.css b/styles/crates.io/catppuccin.user.css index f920d4c8..ffbf50e7 100644 --- a/styles/crates.io/catppuccin.user.css +++ b/styles/crates.io/catppuccin.user.css @@ -311,7 +311,7 @@ } #rgbify(@color) { - @rgb-raw: red(@color), green(@color), blue(@color); + @rgb: red(@color), green(@color), blue(@color); } /* prettier-ignore */ diff --git a/styles/elk/catppuccin.user.css b/styles/elk/catppuccin.user.css index 63731a13..9a3e4323 100644 --- a/styles/elk/catppuccin.user.css +++ b/styles/elk/catppuccin.user.css @@ -71,7 +71,7 @@ --c-border: @surface0 !important; --c-border-dark: @surface1 !important; --c-bg-base: @base !important; - --rgb-bg-base: red(@mantle), green(@mantle), blue(@mantle) !important; + --rgb-bg-base: #rgbify(@mantle) [] !important; --c-bg-active: @surface0 !important; --c-bg-code: @surface0 !important; --c-bg-selection: @accent-color !important; @@ -96,61 +96,41 @@ } ::-webkit-scrollbar-thumb { - background: alpha(@surface1, 0.7); + background: fade(@surface1, 70%); } ::-webkit-scrollbar-thumb:hover { - background: alpha(@surface1, 0.8); + background: fade(@surface1, 80%); } [text-red], [text-red-600], [hover^="text-red"]:hover { - color: rgbA(red(@red), green(@red), blue(@red), var(--un-text-opacity)); + color: rgba(#rgbify(@red) [], var(--un-text-opacity)); } [text-blue], [hover^="text-blue"]:hover { - color: rgbA( - red(@blue), - green(@blue), - blue(@blue), - var(--un-text-opacity) - ); + color: rgba(#rgbify(@blue) [], var(--un-text-opacity)); } [text-green], [hover^="text-green"]:hover { - color: rgbA( - red(@green), - green(@green), - blue(@green), - var(--un-text-opacity) - ); + color: rgba(#rgbify(@green) [], var(--un-text-opacity)); } [text-yellow], [hover^="text-yellow"]:hover { - color: rgbA( - red(@yellow), - green(@yellow), - blue(@yellow), - var(--un-text-opacity) - ); + color: rgba(#rgbify(@yellow) [], var(--un-text-opacity)); } [text-purple], [hover^="text-purple"]:hover { - color: rgbA( - red(@lavender), - green(@lavender), - blue(@lavender), - var(--un-text-opacity) - ); + color: rgba(#rgbify(@lavender) [], var(--un-text-opacity)); } [group-hover^="bg-purple/10"]:hover { - background-color: alpha(@lavender, 0.1); + background-color: fade(@lavender, 10%); } .filter-saturate-0, @@ -160,6 +140,10 @@ } } +#rgbify(@color) { + @rgb: red(@color), green(@color), blue(@color); +} + /* prettier-ignore */ @catppuccin: { @latte: { @rosewater: #dc8a78; @flamingo: #dd7878; @pink: #ea76cb; @mauve: #8839ef; @red: #d20f39; @maroon: #e64553; @peach: #fe640b; @yellow: #df8e1d; @green: #40a02b; @teal: #179299; @sky: #04a5e5; @sapphire: #209fb5; @blue: #1e66f5; @lavender: #7287fd; @text: #4c4f69; @subtext1: #5c5f77; @subtext0: #6c6f85; @overlay2: #7c7f93; @overlay1: #8c8fa1; @overlay0: #9ca0b0; @surface2: #acb0be; @surface1: #bcc0cc; @surface0: #ccd0da; @base: #eff1f5; @mantle: #e6e9ef; @crust: #dce0e8; }; diff --git a/styles/google-drive/catppuccin.user.css b/styles/google-drive/catppuccin.user.css index 51b99b96..47d202dd 100644 --- a/styles/google-drive/catppuccin.user.css +++ b/styles/google-drive/catppuccin.user.css @@ -29,10 +29,6 @@ } } - #rgbify(@color) { - @rgb-raw: red(@color), green(@color), blue(@color); - } - #catppuccin(@lookup, @accent) { @rosewater: @catppuccin[@@lookup][@rosewater]; @flamingo: @catppuccin[@@lookup][@flamingo]; @@ -678,6 +674,10 @@ } } +#rgbify(@color) { + @rgb: red(@color), green(@color), blue(@color); +} + /* prettier-ignore */ @catppuccin: { @latte: { @rosewater: #dc8a78; @flamingo: #dd7878; @pink: #ea76cb; @mauve: #8839ef; @red: #d20f39; @maroon: #e64553; @peach: #fe640b; @yellow: #df8e1d; @green: #40a02b; @teal: #179299; @sky: #04a5e5; @sapphire: #209fb5; @blue: #1e66f5; @lavender: #7287fd; @text: #4c4f69; @subtext1: #5c5f77; @subtext0: #6c6f85; @overlay2: #7c7f93; @overlay1: #8c8fa1; @overlay0: #9ca0b0; @surface2: #acb0be; @surface1: #bcc0cc; @surface0: #ccd0da; @base: #eff1f5; @mantle: #e6e9ef; @crust: #dce0e8; }; diff --git a/styles/google-gemini/catppuccin.user.css b/styles/google-gemini/catppuccin.user.css index 1cca27ca..0431b629 100644 --- a/styles/google-gemini/catppuccin.user.css +++ b/styles/google-gemini/catppuccin.user.css @@ -413,7 +413,7 @@ } #rgbify(@color) { - @rgb-raw: red(@color), green(@color), blue(@color); + @rgb: red(@color), green(@color), blue(@color); } /* prettier-ignore */ diff --git a/styles/google/catppuccin.user.css b/styles/google/catppuccin.user.css index 315c35e2..6ccbaa71 100644 --- a/styles/google/catppuccin.user.css +++ b/styles/google/catppuccin.user.css @@ -956,11 +956,7 @@ background-color: @surface0; } .language_list_languages.tw-ll-top::after { - background: linear-gradient( - to bottom, - rgba(red(@base), green(@base), blue(@base), 0), - rgba(red(@base), green(@base), blue(@base), 1) - ); + background: linear-gradient(to bottom, transparent, @base); } .HsZQAe { border-bottom-color: @surface2; @@ -2423,6 +2419,10 @@ } } +#rgbify(@color) { + @rgb: red(@color), green(@color), blue(@color); +} + /* prettier-ignore */ @catppuccin: { @latte: { @rosewater: #dc8a78; @flamingo: #dd7878; @pink: #ea76cb; @mauve: #8839ef; @red: #d20f39; @maroon: #e64553; @peach: #fe640b; @yellow: #df8e1d; @green: #40a02b; @teal: #179299; @sky: #04a5e5; @sapphire: #209fb5; @blue: #1e66f5; @lavender: #7287fd; @text: #4c4f69; @subtext1: #5c5f77; @subtext0: #6c6f85; @overlay2: #7c7f93; @overlay1: #8c8fa1; @overlay0: #9ca0b0; @surface2: #acb0be; @surface1: #bcc0cc; @surface0: #ccd0da; @base: #eff1f5; @mantle: #e6e9ef; @crust: #dce0e8; }; diff --git a/styles/instagram/catppuccin.user.css b/styles/instagram/catppuccin.user.css index 733f32d5..d9ea4957 100644 --- a/styles/instagram/catppuccin.user.css +++ b/styles/instagram/catppuccin.user.css @@ -852,7 +852,7 @@ } #rgbify(@color) { - @rgb-raw: red(@color), green(@color), blue(@color); + @rgb: red(@color), green(@color), blue(@color); } /* prettier-ignore */ diff --git a/styles/lastfm/catppuccin.user.css b/styles/lastfm/catppuccin.user.css index fb3e79cd..0f4cda95 100644 --- a/styles/lastfm/catppuccin.user.css +++ b/styles/lastfm/catppuccin.user.css @@ -1730,7 +1730,7 @@ } #rgbify(@color) { - @rgb-raw: red(@color) green(@color) blue(@color); + @rgb: red(@color) green(@color) blue(@color); } /* prettier-ignore */ diff --git a/styles/lemmy/catppuccin.user.css b/styles/lemmy/catppuccin.user.css index 56bc1663..551d7e13 100644 --- a/styles/lemmy/catppuccin.user.css +++ b/styles/lemmy/catppuccin.user.css @@ -249,7 +249,7 @@ } #rgbify(@color) { - @rgb-raw: red(@color), green(@color), blue(@color); + @rgb: red(@color), green(@color), blue(@color); } /* prettier-ignore */ diff --git a/styles/mdbook/catppuccin.user.css b/styles/mdbook/catppuccin.user.css index 800dc3de..76d12424 100644 --- a/styles/mdbook/catppuccin.user.css +++ b/styles/mdbook/catppuccin.user.css @@ -155,7 +155,7 @@ } #rgbify(@color) { - @rgb-raw: red(@color), green(@color), blue(@color); + @rgb: red(@color), green(@color), blue(@color); } /* prettier-ignore */ diff --git a/styles/namemc/catppuccin.user.css b/styles/namemc/catppuccin.user.css index 3c1eff6d..c14e272f 100644 --- a/styles/namemc/catppuccin.user.css +++ b/styles/namemc/catppuccin.user.css @@ -95,10 +95,6 @@ --bs-btn-active-color: @hover; } - #rgbify(@color) { - @rgb-raw: red(@color), green(@color), blue(@color); - } - --bs-body-color: @text; --bs-body-color-rgb: #rgbify(@text) []; --bs-body-bg: @base; @@ -567,6 +563,10 @@ } } +#rgbify(@color) { + @rgb: red(@color), green(@color), blue(@color); +} + /* prettier-ignore */ @catppuccin: { @latte: { @rosewater: #dc8a78; @flamingo: #dd7878; @pink: #ea76cb; @mauve: #8839ef; @red: #d20f39; @maroon: #e64553; @peach: #fe640b; @yellow: #df8e1d; @green: #40a02b; @teal: #179299; @sky: #04a5e5; @sapphire: #209fb5; @blue: #1e66f5; @lavender: #7287fd; @text: #4c4f69; @subtext1: #5c5f77; @subtext0: #6c6f85; @overlay2: #7c7f93; @overlay1: #8c8fa1; @overlay0: #9ca0b0; @surface2: #acb0be; @surface1: #bcc0cc; @surface0: #ccd0da; @base: #eff1f5; @mantle: #e6e9ef; @crust: #dce0e8; }; diff --git a/styles/nitter/catppuccin.user.css b/styles/nitter/catppuccin.user.css index 82ae209e..9f63cb76 100644 --- a/styles/nitter/catppuccin.user.css +++ b/styles/nitter/catppuccin.user.css @@ -150,7 +150,7 @@ } #rgbify(@color) { - @rgb-raw: red(@color) green(@color) blue(@color); + @rgb: red(@color) green(@color) blue(@color); } /* prettier-ignore */ diff --git a/styles/ollama/catppuccin.user.css b/styles/ollama/catppuccin.user.css index ec015be8..d4b1c180 100644 --- a/styles/ollama/catppuccin.user.css +++ b/styles/ollama/catppuccin.user.css @@ -277,7 +277,7 @@ } #rgbify(@color) { - @rgb-raw: red(@color), green(@color), blue(@color); + @rgb: red(@color), green(@color), blue(@color); } /* prettier-ignore */ diff --git a/styles/perplexity/catppuccin.user.css b/styles/perplexity/catppuccin.user.css index 1e02982a..1c200ab9 100644 --- a/styles/perplexity/catppuccin.user.css +++ b/styles/perplexity/catppuccin.user.css @@ -435,7 +435,7 @@ } #rgbify(@color) { - @rgb-raw: red(@color) green(@color) blue(@color); + @rgb: red(@color) green(@color) blue(@color); } /* prettier-ignore */ diff --git a/styles/pronouns.cc/catppuccin.user.css b/styles/pronouns.cc/catppuccin.user.css index 8d4b56a6..6c0a5515 100644 --- a/styles/pronouns.cc/catppuccin.user.css +++ b/styles/pronouns.cc/catppuccin.user.css @@ -248,7 +248,7 @@ } #rgbify(@color) { - @rgb-raw: red(@color), green(@color), blue(@color); + @rgb: red(@color), green(@color), blue(@color); } /* prettier-ignore */ diff --git a/styles/pronouns.page/catppuccin.user.css b/styles/pronouns.page/catppuccin.user.css index 6c7322be..bfb765e6 100644 --- a/styles/pronouns.page/catppuccin.user.css +++ b/styles/pronouns.page/catppuccin.user.css @@ -470,7 +470,7 @@ } #rgbify(@color) { - @rgb-raw: red(@color), green(@color), blue(@color); + @rgb: red(@color), green(@color), blue(@color); } /* prettier-ignore */ diff --git a/styles/stack-overflow/catppuccin.user.css b/styles/stack-overflow/catppuccin.user.css index e9607acc..dcc923a6 100644 --- a/styles/stack-overflow/catppuccin.user.css +++ b/styles/stack-overflow/catppuccin.user.css @@ -485,7 +485,7 @@ domain('superuser.com'), domain('mathoverflow.net'), domain('askubuntu.com'), do } #rgbify(@color) { - @rgb-raw: red(@color), green(@color), blue(@color); + @rgb: red(@color), green(@color), blue(@color); } /* prettier-ignore */ diff --git a/styles/substack/catppuccin.user.css b/styles/substack/catppuccin.user.css index 473989e5..21c31a9f 100644 --- a/styles/substack/catppuccin.user.css +++ b/styles/substack/catppuccin.user.css @@ -295,7 +295,7 @@ } #rgbify(@color) { - @rgb-raw: red(@color), green(@color), blue(@color); + @rgb: red(@color), green(@color), blue(@color); } /* prettier-ignore */ diff --git a/styles/trinket/catppuccin.user.css b/styles/trinket/catppuccin.user.css index 37653d78..c2cf36c7 100644 --- a/styles/trinket/catppuccin.user.css +++ b/styles/trinket/catppuccin.user.css @@ -1321,7 +1321,7 @@ } #rgbify(@color) { - @rgb-raw: red(@color), green(@color), blue(@color); + @rgb: red(@color), green(@color), blue(@color); } /* prettier-ignore */ diff --git a/styles/vercel/catppuccin.user.css b/styles/vercel/catppuccin.user.css index 66e8ae66..fd70c0ff 100644 --- a/styles/vercel/catppuccin.user.css +++ b/styles/vercel/catppuccin.user.css @@ -319,7 +319,7 @@ } #rgbify(@color) { - @rgb-raw: red(@color), green(@color), blue(@color); + @rgb: red(@color), green(@color), blue(@color); } /* prettier-ignore */ diff --git a/styles/whatsapp-web/catppuccin.user.css b/styles/whatsapp-web/catppuccin.user.css index 8e683e1e..d82899a6 100644 --- a/styles/whatsapp-web/catppuccin.user.css +++ b/styles/whatsapp-web/catppuccin.user.css @@ -673,7 +673,7 @@ } #rgbify(@color) { - @rgb-raw: red(@color) green(@color) blue(@color); + @rgb: red(@color) green(@color) blue(@color); } /* prettier-ignore */