diff --git a/README.md b/README.md index ff890eef..e38a7725 100644 --- a/README.md +++ b/README.md @@ -472,12 +472,22 @@ You'll have to restart your session for themes to take effect. ## Terminal Integration -**Ghostty users** can add automatic color theming: +The matugen integration will automatically generate new colors for certain apps only if they are installed. + +You can enable the dynamic color schemes in supported terminal apps by modifying their configurations: + +**Ghostty**: ```bash echo "config-file = ./config-dankcolors" >> ~/.config/ghostty/config ``` +**kitty**: + +```bash +echo "include dank-theme.conf" >> ~/.config/kitty/kitty.conf +``` + ## Calendar Setup Sync your caldev compatible calendar (Google, Office365, etc.) for dashboard integration: diff --git a/matugen/b16.py b/matugen/b16.py index dd1867e3..cc079ce4 100755 --- a/matugen/b16.py +++ b/matugen/b16.py @@ -59,16 +59,42 @@ def generate_palette(base_color, is_light=False): return palette if __name__ == "__main__": - if len(sys.argv) < 2 or len(sys.argv) > 3: - print("Usage: b16.py [--light]", file=sys.stderr) + if len(sys.argv) < 2 or len(sys.argv) > 4: + print("Usage: b16.py [--light] [--kitty]", file=sys.stderr) sys.exit(1) base = sys.argv[1] if not base.startswith('#'): base = '#' + base - is_light = len(sys.argv) == 3 and sys.argv[2] == "--light" + is_light = "--light" in sys.argv + is_kitty = "--kitty" in sys.argv colors = generate_palette(base, is_light) - for i, color in enumerate(colors): - print(f"palette = {i}={color}") \ No newline at end of file + if is_kitty: + # Kitty color format mapping + kitty_colors = [ + ("color0", colors[0]), # black + ("color1", colors[1]), # red + ("color2", colors[2]), # green + ("color3", colors[3]), # yellow + ("color4", colors[4]), # blue + ("color5", colors[5]), # magenta + ("color6", colors[6]), # cyan + ("color7", colors[7]), # white + ("color8", colors[8]), # bright black + ("color9", colors[9]), # bright red + ("color10", colors[10]), # bright green + ("color11", colors[11]), # bright yellow + ("color12", colors[12]), # bright blue + ("color13", colors[13]), # bright magenta + ("color14", colors[14]), # bright cyan + ("color15", colors[15]) # bright white + ] + + for name, color in kitty_colors: + print(f"{name} {color}") + else: + # Ghostty format (original) + for i, color in enumerate(colors): + print(f"palette = {i}={color}") \ No newline at end of file diff --git a/matugen/configs/kitty.toml b/matugen/configs/kitty.toml new file mode 100644 index 00000000..30fc1bb2 --- /dev/null +++ b/matugen/configs/kitty.toml @@ -0,0 +1,3 @@ +[templates.kitty] +input_path = './matugen/templates/kitty.conf' +output_path = '~/.config/kitty/dank-theme.conf' \ No newline at end of file diff --git a/matugen/templates/kitty.conf b/matugen/templates/kitty.conf new file mode 100644 index 00000000..04f2213b --- /dev/null +++ b/matugen/templates/kitty.conf @@ -0,0 +1,8 @@ +cursor {{colors.on_surface.default.hex}} +cursor_text_color {{colors.on_surface_variant.default.hex}} + +foreground {{colors.on_surface.default.hex}} +background {{colors.surface.default.hex}} +selection_foreground {{colors.on_secondary.default.hex}} +selection_background {{colors.secondary_fixed_dim.default.hex}} +url_color {{colors.primary.default.hex}} \ No newline at end of file diff --git a/scripts/matugen.sh b/scripts/matugen.sh index b40fc770..c4382e64 100755 --- a/scripts/matugen.sh +++ b/scripts/matugen.sh @@ -106,6 +106,15 @@ build_content_config() { echo " - Skipping ghostty config (ghostty not found)" fi + if command -v kitty >/dev/null 2>&1; then + echo " - Including kitty config (kitty found)" + cat "$shell_dir/matugen/configs/kitty.toml" >> "$temp_config" + sed -i "s|input_path = './matugen/templates/|input_path = '$shell_dir/matugen/templates/|g" "$temp_config" + echo "" >> "$temp_config" + else + echo " - Skipping kitty config (kitty not found)" + fi + if command -v dgop >/dev/null 2>&1; then echo " - Including dgop config (dgop found)" cat "$shell_dir/matugen/configs/dgop.toml" >> "$temp_config" @@ -221,6 +230,41 @@ if [ -s "$TEMP_CONTENT_CONFIG" ] && grep -q '\[templates\.' "$TEMP_CONTENT_CONFI echo "Warning: Failed to generate base16 palette" fi fi + + if command -v kitty >/dev/null 2>&1; then + echo "Generating base16 palette for kitty..." + + PRIMARY_COLOR="$EXTRACTED_PRIMARY" + if [ -z "$PRIMARY_COLOR" ]; then + PRIMARY_COLOR="#6b5f8e" + echo "Warning: Could not extract primary color, using fallback: $PRIMARY_COLOR" + fi + + B16_ARGS="$PRIMARY_COLOR" + if [ "$IS_LIGHT" = "true" ]; then + B16_ARGS="$B16_ARGS --light" + fi + + B16_OUTPUT=$("$SHELL_DIR/matugen/b16.py" $B16_ARGS --kitty) + + if [ $? -eq 0 ] && [ -n "$B16_OUTPUT" ]; then + TEMP_KITTY="/tmp/kitty-config-$$.conf" + echo "$B16_OUTPUT" > "$TEMP_KITTY" + echo "" >> "$TEMP_KITTY" + + if [ -f "$CONFIG_DIR/kitty/dank-theme.conf" ]; then + cat "$CONFIG_DIR/kitty/dank-theme.conf" >> "$TEMP_KITTY" + else + echo "Warning: $CONFIG_DIR/kitty/dank-theme.conf not found" + fi + + mkdir -p "$CONFIG_DIR/kitty" + mv "$TEMP_KITTY" "$CONFIG_DIR/kitty/dank-theme.conf" + echo "Base16 palette prepended to kitty config" + else + echo "Warning: Failed to generate base16 palette for kitty" + fi + fi else echo "No content-specific tools found, skipping content generation" fi @@ -246,4 +290,5 @@ command -v niri >/dev/null 2>&1 && [ -f "$CONFIG_DIR/niri/dankshell-colors.kdl" command -v qt5ct >/dev/null 2>&1 && [ -f "$CONFIG_DIR/qt5ct/colors/matugen.conf" ] && echo " - Qt5ct themes" command -v qt6ct >/dev/null 2>&1 && [ -f "$CONFIG_DIR/qt6ct/colors/matugen.conf" ] && echo " - Qt6ct themes" command -v ghostty >/dev/null 2>&1 && [ -f "$CONFIG_DIR/ghostty/config-dankcolors" ] && echo " - Ghostty terminal" +command -v kitty >/dev/null 2>&1 && [ -f "$CONFIG_DIR/kitty/dank-theme.conf" ] && echo " - Kitty terminal" command -v dgop >/dev/null 2>&1 && [ -f "$CONFIG_DIR/dgop/colors.json" ] && echo " - Dgop colors"