diff --git a/lib/discord.nix b/lib/discord.nix index 3e6430c..a1bd2c5 100644 --- a/lib/discord.nix +++ b/lib/discord.nix @@ -96,29 +96,49 @@ &.hljs { @if $format == "inject" { - color: map.get($colors, "text") if($important, !important, null); - background: map.get($colors, "base") if($important, !important, null); + @if $important { + color: map.get($colors, "text") !important; + background: map.get($colors, "base") !important; + } @else { + color: map.get($colors, "text"); + background: map.get($colors, "base"); + } } } @each $key, $value in $highlights { .hljs-#{$key} { @if $format == "inject" { - color: map.get($colors, $value) if($important, !important, null); + @if $important { + color: map.get($colors, $value) !important; + } @else { + color: map.get($colors, $value); + } } @if map.has-key($fontStyles, $key) { @if map.get($fontStyles, $key) == "bold" { - font-weight: bold if($important, !important, null); + @if $important { + font-weight: bold !important; + } @else { + font-weight: bold; + } } @else if map.get($fontStyles, $key) == "italic" { - font-style: italic if($important, !important, null); + @if $important { + font-style: italic !important; + } @else { + font-style: italic; + } } } @if ($key == "addition" or $key == "deletion") { @if $format == "inject" { - background: color.change(map.get($colors, $value), $alpha: 0.15) - if($important, !important, null); + @if $important { + background: color.change(map.get($colors, $value), $alpha: 0.15) !important; + } @else { + background: color.change(map.get($colors, $value), $alpha: 0.15); + } } } } diff --git a/lib/mkUserStyles.nix b/lib/mkUserStyles.nix index 4dae439..7a4cea9 100644 --- a/lib/mkUserStyles.nix +++ b/lib/mkUserStyles.nix @@ -146,13 +146,15 @@ in # replace catppuccin mocha colors with user-defined palette colors cat catppuccin.userstyles.css extra.userstyles.css > userstyles.css 2>/dev/null || cat extra.userstyles.css > userstyles.css - substituteInPlace userstyles.css \ - ${concatStringsSep " \\\n " ( - map ( - mapping: "--replace-warn ${escapeShellArg catppuccin.palette.${mapping.name}} ${escapeShellArg palette24.${mapping.base}}" + printf '%s\n' ${escapeShellArg ( + concatStringsSep "\n" ( + map ( + mapping: "s|${catppuccin.palette.${mapping.name}}|${palette24.${mapping.base}}|gI" + ) + catppuccin.replacements ) - catppuccin.replacements - )} + )} > palette-replacements.sed + sed -i -f palette-replacements.sed userstyles.css # !important ${getExe importantize} < userstyles.css > $out