mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-28 15:32:50 -05:00
proper KColorScheme generation
This commit is contained in:
@@ -96,71 +96,34 @@ update_qt_config() {
|
|||||||
update_qt_color_config() {
|
update_qt_color_config() {
|
||||||
local config_file="$1"
|
local config_file="$1"
|
||||||
local version="$2"
|
local version="$2"
|
||||||
local color_scheme_path="$config_dir/qt${version}ct/colors/matugen.conf"
|
local color_scheme_path="$(dirname "$config_dir")/.local/share/color-schemes/DankMatugen.colors"
|
||||||
|
|
||||||
if [ -f "$config_file" ]; then
|
if [ -f "$config_file" ]; then
|
||||||
# Read the entire file and carefully update only what we need
|
# Use a simple sed approach to only update specific lines
|
||||||
python3 -c "
|
# First, check if the [Appearance] section exists
|
||||||
import sys
|
if grep -q '^\[Appearance\]' "$config_file"; then
|
||||||
import re
|
# Update custom_palette if it exists, otherwise add it after [Appearance]
|
||||||
|
if grep -q '^custom_palette=' "$config_file"; then
|
||||||
config_file = '$config_file'
|
sed -i 's/^custom_palette=.*/custom_palette=true/' "$config_file"
|
||||||
color_scheme_path = '$color_scheme_path'
|
else
|
||||||
|
sed -i '/^\[Appearance\]/a custom_palette=true' "$config_file"
|
||||||
try:
|
fi
|
||||||
with open(config_file, 'r') as f:
|
|
||||||
content = f.read()
|
# Update color_scheme_path if it exists, otherwise add it after [Appearance]
|
||||||
|
if grep -q '^color_scheme_path=' "$config_file"; then
|
||||||
lines = content.split('\n')
|
sed -i "s|^color_scheme_path=.*|color_scheme_path=$color_scheme_path|" "$config_file"
|
||||||
result = []
|
else
|
||||||
in_appearance = False
|
sed -i "/^\[Appearance\]/a color_scheme_path=$color_scheme_path" "$config_file"
|
||||||
custom_palette_found = False
|
fi
|
||||||
color_scheme_found = False
|
else
|
||||||
|
# Add [Appearance] section at the end with our settings
|
||||||
for line in lines:
|
echo "" >> "$config_file"
|
||||||
stripped = line.strip()
|
echo "[Appearance]" >> "$config_file"
|
||||||
|
echo "custom_palette=true" >> "$config_file"
|
||||||
if stripped == '[Appearance]':
|
echo "color_scheme_path=$color_scheme_path" >> "$config_file"
|
||||||
in_appearance = True
|
fi
|
||||||
result.append(line)
|
|
||||||
elif stripped.startswith('[') and stripped != '[Appearance]':
|
|
||||||
# End of [Appearance] section, add missing settings if needed
|
|
||||||
if in_appearance:
|
|
||||||
if not custom_palette_found:
|
|
||||||
result.append('custom_palette=true')
|
|
||||||
if not color_scheme_found:
|
|
||||||
result.append('color_scheme_path=' + color_scheme_path)
|
|
||||||
in_appearance = False
|
|
||||||
result.append(line)
|
|
||||||
elif in_appearance and stripped.startswith('custom_palette='):
|
|
||||||
custom_palette_found = True
|
|
||||||
result.append('custom_palette=true')
|
|
||||||
elif in_appearance and stripped.startswith('color_scheme_path='):
|
|
||||||
color_scheme_found = True
|
|
||||||
result.append('color_scheme_path=' + color_scheme_path)
|
|
||||||
else:
|
|
||||||
result.append(line)
|
|
||||||
|
|
||||||
# Handle case where [Appearance] is the last section
|
|
||||||
if in_appearance:
|
|
||||||
if not custom_palette_found:
|
|
||||||
result.append('custom_palette=true')
|
|
||||||
if not color_scheme_found:
|
|
||||||
result.append('color_scheme_path=' + color_scheme_path)
|
|
||||||
|
|
||||||
# If no [Appearance] section exists, create one
|
|
||||||
if not any('[Appearance]' in line for line in lines):
|
|
||||||
result.extend(['', '[Appearance]', 'custom_palette=true', 'color_scheme_path=' + color_scheme_path])
|
|
||||||
|
|
||||||
with open(config_file, 'w') as f:
|
|
||||||
f.write('\n'.join(result))
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f'Error updating {config_file}: {e}', file=sys.stderr)
|
|
||||||
sys.exit(1)
|
|
||||||
"
|
|
||||||
else
|
else
|
||||||
# Create new config file
|
# Create new config file with minimal settings
|
||||||
printf '[Appearance]\ncustom_palette=true\ncolor_scheme_path=%s\n' "$color_scheme_path" > "$config_file"
|
printf '[Appearance]\ncustom_palette=true\ncolor_scheme_path=%s\n' "$color_scheme_path" > "$config_file"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,8 @@ output_path = '~/.config/qt5ct/colors/matugen.conf'
|
|||||||
|
|
||||||
[templates.qt6ct]
|
[templates.qt6ct]
|
||||||
input_path = './templates/qtct-colors.conf'
|
input_path = './templates/qtct-colors.conf'
|
||||||
output_path = '~/.config/qt6ct/colors/matugen.conf'
|
output_path = '~/.config/qt6ct/colors/matugen.conf'
|
||||||
|
|
||||||
|
[templates.kcolorscheme]
|
||||||
|
input_path = './templates/matugen-kcolorscheme.colors'
|
||||||
|
output_path = '~/.local/share/color-schemes/DankMatugen.colors'
|
||||||
146
templates/matugen-kcolorscheme.colors
Normal file
146
templates/matugen-kcolorscheme.colors
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
[KDE]
|
||||||
|
contrast=4
|
||||||
|
|
||||||
|
[General]
|
||||||
|
ColorScheme=DankMatugen
|
||||||
|
Name=Dank Shell (matugen)
|
||||||
|
|
||||||
|
[ColorEffects:Disabled]
|
||||||
|
Color={{colors.on_surface_variant.default.red}},{{colors.on_surface_variant.default.green}},{{colors.on_surface_variant.default.blue}}
|
||||||
|
ColorAmount=0
|
||||||
|
ColorEffect=0
|
||||||
|
ContrastAmount=0.65
|
||||||
|
ContrastEffect=1
|
||||||
|
IntensityAmount=0.1
|
||||||
|
IntensityEffect=2
|
||||||
|
|
||||||
|
[ColorEffects:Inactive]
|
||||||
|
ChangeSelectionColor=true
|
||||||
|
Color={{colors.outline.default.red}},{{colors.outline.default.green}},{{colors.outline.default.blue}}
|
||||||
|
ColorAmount=0.025
|
||||||
|
ColorEffect=2
|
||||||
|
ContrastAmount=0.1
|
||||||
|
ContrastEffect=2
|
||||||
|
Enable=false
|
||||||
|
IntensityAmount=0
|
||||||
|
IntensityEffect=0
|
||||||
|
|
||||||
|
[Colors:Button]
|
||||||
|
BackgroundAlternate={{colors.surface_container_high.default.red}},{{colors.surface_container_high.default.green}},{{colors.surface_container_high.default.blue}}
|
||||||
|
BackgroundNormal={{colors.surface_container.default.red}},{{colors.surface_container.default.green}},{{colors.surface_container.default.blue}}
|
||||||
|
DecorationFocus={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
DecorationHover={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
ForegroundActive={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
ForegroundInactive={{colors.on_surface_variant.default.red}},{{colors.on_surface_variant.default.green}},{{colors.on_surface_variant.default.blue}}
|
||||||
|
ForegroundLink={{colors.tertiary.default.red}},{{colors.tertiary.default.green}},{{colors.tertiary.default.blue}}
|
||||||
|
ForegroundNegative={{colors.error.default.red}},{{colors.error.default.green}},{{colors.error.default.blue}}
|
||||||
|
ForegroundNeutral={{colors.secondary.default.red}},{{colors.secondary.default.green}},{{colors.secondary.default.blue}}
|
||||||
|
ForegroundNormal={{colors.on_surface.default.red}},{{colors.on_surface.default.green}},{{colors.on_surface.default.blue}}
|
||||||
|
ForegroundPositive={{colors.tertiary.default.red}},{{colors.tertiary.default.green}},{{colors.tertiary.default.blue}}
|
||||||
|
ForegroundVisited={{colors.secondary.default.red}},{{colors.secondary.default.green}},{{colors.secondary.default.blue}}
|
||||||
|
|
||||||
|
[Colors:Complementary]
|
||||||
|
BackgroundAlternate={{colors.surface_container_high.default.red}},{{colors.surface_container_high.default.green}},{{colors.surface_container_high.default.blue}}
|
||||||
|
BackgroundNormal={{colors.surface.default.red}},{{colors.surface.default.green}},{{colors.surface.default.blue}}
|
||||||
|
DecorationFocus={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
DecorationHover={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
ForegroundActive={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
ForegroundInactive={{colors.on_surface_variant.default.red}},{{colors.on_surface_variant.default.green}},{{colors.on_surface_variant.default.blue}}
|
||||||
|
ForegroundLink={{colors.tertiary.default.red}},{{colors.tertiary.default.green}},{{colors.tertiary.default.blue}}
|
||||||
|
ForegroundNegative={{colors.error.default.red}},{{colors.error.default.green}},{{colors.error.default.blue}}
|
||||||
|
ForegroundNeutral={{colors.secondary.default.red}},{{colors.secondary.default.green}},{{colors.secondary.default.blue}}
|
||||||
|
ForegroundNormal={{colors.on_surface.default.red}},{{colors.on_surface.default.green}},{{colors.on_surface.default.blue}}
|
||||||
|
ForegroundPositive={{colors.tertiary.default.red}},{{colors.tertiary.default.green}},{{colors.tertiary.default.blue}}
|
||||||
|
ForegroundVisited={{colors.secondary.default.red}},{{colors.secondary.default.green}},{{colors.secondary.default.blue}}
|
||||||
|
|
||||||
|
[Colors:Header]
|
||||||
|
BackgroundAlternate={{colors.surface.default.red}},{{colors.surface.default.green}},{{colors.surface.default.blue}}
|
||||||
|
BackgroundNormal={{colors.surface_container.default.red}},{{colors.surface_container.default.green}},{{colors.surface_container.default.blue}}
|
||||||
|
DecorationFocus={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
DecorationHover={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
ForegroundActive={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
ForegroundInactive={{colors.on_surface_variant.default.red}},{{colors.on_surface_variant.default.green}},{{colors.on_surface_variant.default.blue}}
|
||||||
|
ForegroundLink={{colors.tertiary.default.red}},{{colors.tertiary.default.green}},{{colors.tertiary.default.blue}}
|
||||||
|
ForegroundNegative={{colors.error.default.red}},{{colors.error.default.green}},{{colors.error.default.blue}}
|
||||||
|
ForegroundNeutral={{colors.secondary.default.red}},{{colors.secondary.default.green}},{{colors.secondary.default.blue}}
|
||||||
|
ForegroundNormal={{colors.on_surface.default.red}},{{colors.on_surface.default.green}},{{colors.on_surface.default.blue}}
|
||||||
|
ForegroundPositive={{colors.tertiary.default.red}},{{colors.tertiary.default.green}},{{colors.tertiary.default.blue}}
|
||||||
|
ForegroundVisited={{colors.secondary.default.red}},{{colors.secondary.default.green}},{{colors.secondary.default.blue}}
|
||||||
|
|
||||||
|
[Colors:Header][Inactive]
|
||||||
|
BackgroundAlternate={{colors.surface_container.default.red}},{{colors.surface_container.default.green}},{{colors.surface_container.default.blue}}
|
||||||
|
BackgroundNormal={{colors.surface.default.red}},{{colors.surface.default.green}},{{colors.surface.default.blue}}
|
||||||
|
DecorationFocus={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
DecorationHover={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
ForegroundActive={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
ForegroundInactive={{colors.on_surface_variant.default.red}},{{colors.on_surface_variant.default.green}},{{colors.on_surface_variant.default.blue}}
|
||||||
|
ForegroundLink={{colors.tertiary.default.red}},{{colors.tertiary.default.green}},{{colors.tertiary.default.blue}}
|
||||||
|
ForegroundNegative={{colors.error.default.red}},{{colors.error.default.green}},{{colors.error.default.blue}}
|
||||||
|
ForegroundNeutral={{colors.secondary.default.red}},{{colors.secondary.default.green}},{{colors.secondary.default.blue}}
|
||||||
|
ForegroundNormal={{colors.on_surface.default.red}},{{colors.on_surface.default.green}},{{colors.on_surface.default.blue}}
|
||||||
|
ForegroundPositive={{colors.tertiary.default.red}},{{colors.tertiary.default.green}},{{colors.tertiary.default.blue}}
|
||||||
|
ForegroundVisited={{colors.secondary.default.red}},{{colors.secondary.default.green}},{{colors.secondary.default.blue}}
|
||||||
|
|
||||||
|
[Colors:Selection]
|
||||||
|
BackgroundAlternate={{colors.primary_container.default.red}},{{colors.primary_container.default.green}},{{colors.primary_container.default.blue}}
|
||||||
|
BackgroundNormal={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
DecorationFocus={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
DecorationHover={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
ForegroundActive={{colors.on_primary.default.red}},{{colors.on_primary.default.green}},{{colors.on_primary.default.blue}}
|
||||||
|
ForegroundInactive={{colors.on_surface_variant.default.red}},{{colors.on_surface_variant.default.green}},{{colors.on_surface_variant.default.blue}}
|
||||||
|
ForegroundLink={{colors.tertiary.default.red}},{{colors.tertiary.default.green}},{{colors.tertiary.default.blue}}
|
||||||
|
ForegroundNegative={{colors.error.default.red}},{{colors.error.default.green}},{{colors.error.default.blue}}
|
||||||
|
ForegroundNeutral={{colors.secondary.default.red}},{{colors.secondary.default.green}},{{colors.secondary.default.blue}}
|
||||||
|
ForegroundNormal={{colors.on_primary.default.red}},{{colors.on_primary.default.green}},{{colors.on_primary.default.blue}}
|
||||||
|
ForegroundPositive={{colors.tertiary.default.red}},{{colors.tertiary.default.green}},{{colors.tertiary.default.blue}}
|
||||||
|
ForegroundVisited={{colors.secondary.default.red}},{{colors.secondary.default.green}},{{colors.secondary.default.blue}}
|
||||||
|
|
||||||
|
[Colors:Tooltip]
|
||||||
|
BackgroundAlternate={{colors.surface.default.red}},{{colors.surface.default.green}},{{colors.surface.default.blue}}
|
||||||
|
BackgroundNormal={{colors.surface_container.default.red}},{{colors.surface_container.default.green}},{{colors.surface_container.default.blue}}
|
||||||
|
DecorationFocus={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
DecorationHover={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
ForegroundActive={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
ForegroundInactive={{colors.on_surface_variant.default.red}},{{colors.on_surface_variant.default.green}},{{colors.on_surface_variant.default.blue}}
|
||||||
|
ForegroundLink={{colors.tertiary.default.red}},{{colors.tertiary.default.green}},{{colors.tertiary.default.blue}}
|
||||||
|
ForegroundNegative={{colors.error.default.red}},{{colors.error.default.green}},{{colors.error.default.blue}}
|
||||||
|
ForegroundNeutral={{colors.secondary.default.red}},{{colors.secondary.default.green}},{{colors.secondary.default.blue}}
|
||||||
|
ForegroundNormal={{colors.on_surface.default.red}},{{colors.on_surface.default.green}},{{colors.on_surface.default.blue}}
|
||||||
|
ForegroundPositive={{colors.tertiary.default.red}},{{colors.tertiary.default.green}},{{colors.tertiary.default.blue}}
|
||||||
|
ForegroundVisited={{colors.secondary.default.red}},{{colors.secondary.default.green}},{{colors.secondary.default.blue}}
|
||||||
|
|
||||||
|
[Colors:View]
|
||||||
|
BackgroundAlternate={{colors.surface_container_low.default.red}},{{colors.surface_container_low.default.green}},{{colors.surface_container_low.default.blue}}
|
||||||
|
BackgroundNormal={{colors.background.default.red}},{{colors.background.default.green}},{{colors.background.default.blue}}
|
||||||
|
DecorationFocus={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
DecorationHover={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
ForegroundActive={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
ForegroundInactive={{colors.on_surface_variant.default.red}},{{colors.on_surface_variant.default.green}},{{colors.on_surface_variant.default.blue}}
|
||||||
|
ForegroundLink={{colors.tertiary.default.red}},{{colors.tertiary.default.green}},{{colors.tertiary.default.blue}}
|
||||||
|
ForegroundNegative={{colors.error.default.red}},{{colors.error.default.green}},{{colors.error.default.blue}}
|
||||||
|
ForegroundNeutral={{colors.secondary.default.red}},{{colors.secondary.default.green}},{{colors.secondary.default.blue}}
|
||||||
|
ForegroundNormal={{colors.on_surface.default.red}},{{colors.on_surface.default.green}},{{colors.on_surface.default.blue}}
|
||||||
|
ForegroundPositive={{colors.tertiary.default.red}},{{colors.tertiary.default.green}},{{colors.tertiary.default.blue}}
|
||||||
|
ForegroundVisited={{colors.secondary.default.red}},{{colors.secondary.default.green}},{{colors.secondary.default.blue}}
|
||||||
|
|
||||||
|
[Colors:Window]
|
||||||
|
BackgroundAlternate={{colors.surface_container.default.red}},{{colors.surface_container.default.green}},{{colors.surface_container.default.blue}}
|
||||||
|
BackgroundNormal={{colors.surface.default.red}},{{colors.surface.default.green}},{{colors.surface.default.blue}}
|
||||||
|
DecorationFocus={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
DecorationHover={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
ForegroundActive={{colors.primary.default.red}},{{colors.primary.default.green}},{{colors.primary.default.blue}}
|
||||||
|
ForegroundInactive={{colors.on_surface_variant.default.red}},{{colors.on_surface_variant.default.green}},{{colors.on_surface_variant.default.blue}}
|
||||||
|
ForegroundLink={{colors.tertiary.default.red}},{{colors.tertiary.default.green}},{{colors.tertiary.default.blue}}
|
||||||
|
ForegroundNegative={{colors.error.default.red}},{{colors.error.default.green}},{{colors.error.default.blue}}
|
||||||
|
ForegroundNeutral={{colors.secondary.default.red}},{{colors.secondary.default.green}},{{colors.secondary.default.blue}}
|
||||||
|
ForegroundNormal={{colors.on_surface.default.red}},{{colors.on_surface.default.green}},{{colors.on_surface.default.blue}}
|
||||||
|
ForegroundPositive={{colors.tertiary.default.red}},{{colors.tertiary.default.green}},{{colors.tertiary.default.blue}}
|
||||||
|
ForegroundVisited={{colors.secondary.default.red}},{{colors.secondary.default.green}},{{colors.secondary.default.blue}}
|
||||||
|
|
||||||
|
[WM]
|
||||||
|
activeBackground={{colors.surface_container.default.red}},{{colors.surface_container.default.green}},{{colors.surface_container.default.blue}}
|
||||||
|
activeBlend={{colors.on_surface.default.red}},{{colors.on_surface.default.green}},{{colors.on_surface.default.blue}}
|
||||||
|
activeForeground={{colors.on_surface.default.red}},{{colors.on_surface.default.green}},{{colors.on_surface.default.blue}}
|
||||||
|
inactiveBackground={{colors.surface.default.red}},{{colors.surface.default.green}},{{colors.surface.default.blue}}
|
||||||
|
inactiveBlend={{colors.on_surface_variant.default.red}},{{colors.on_surface_variant.default.green}},{{colors.on_surface_variant.default.blue}}
|
||||||
|
inactiveForeground={{colors.on_surface_variant.default.red}},{{colors.on_surface_variant.default.green}},{{colors.on_surface_variant.default.blue}}
|
||||||
Reference in New Issue
Block a user