1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00

matugen: add vscode theme, switch to dms dank16

This commit is contained in:
bbedward
2025-11-02 01:42:20 -04:00
parent 5a8a60b15d
commit baaebcd413
6 changed files with 401 additions and 255 deletions

View File

@@ -0,0 +1,13 @@
[templates.dmsvscodedefault]
input_path = './matugen/templates/vscode-color-theme.json'
output_path = '~/.vscode/extensions/local.dynamic-base16-dankshell-0.0.1/themes/dankshell-default-base.json'
[templates.dmsvscodedark]
input_path = './matugen/templates/vscode-color-theme.json'
output_path = '~/.vscode/extensions/local.dynamic-base16-dankshell-0.0.1/themes/dankshell-dark-base.json'
mode = 'Dark'
[templates.dmsvscodelight]
input_path = './matugen/templates/vscode-color-theme.json'
output_path = '~/.vscode/extensions/local.dynamic-base16-dankshell-0.0.1/themes/dankshell-light-base.json'
mode = 'Light'

View File

@@ -1,252 +0,0 @@
#!/usr/bin/env python3
import colorsys
import sys
def hex_to_rgb(hex_color):
hex_color = hex_color.lstrip('#')
return tuple(int(hex_color[i:i+2], 16)/255.0 for i in (0, 2, 4))
def rgb_to_hex(r, g, b):
r = max(0, min(1, r))
g = max(0, min(1, g))
b = max(0, min(1, b))
return f"#{int(r*255):02x}{int(g*255):02x}{int(b*255):02x}"
def luminance(hex_color):
r, g, b = hex_to_rgb(hex_color)
def srgb_to_linear(c):
return c/12.92 if c <= 0.03928 else ((c + 0.055)/1.055) ** 2.4
return 0.2126 * srgb_to_linear(r) + 0.7152 * srgb_to_linear(g) + 0.0722 * srgb_to_linear(b)
def contrast_ratio(hex_fg, hex_bg):
lum_fg = luminance(hex_fg)
lum_bg = luminance(hex_bg)
lighter = max(lum_fg, lum_bg)
darker = min(lum_fg, lum_bg)
return (lighter + 0.05) / (darker + 0.05)
def ensure_contrast(hex_color, hex_bg, min_ratio=4.5, is_light_mode=False):
current_ratio = contrast_ratio(hex_color, hex_bg)
if current_ratio >= min_ratio:
return hex_color
r, g, b = hex_to_rgb(hex_color)
h, s, v = colorsys.rgb_to_hsv(r, g, b)
for step in range(1, 30):
delta = step * 0.02
if is_light_mode:
new_v = max(0, v - delta)
candidate = rgb_to_hex(*colorsys.hsv_to_rgb(h, s, new_v))
if contrast_ratio(candidate, hex_bg) >= min_ratio:
return candidate
new_v = min(1, v + delta)
candidate = rgb_to_hex(*colorsys.hsv_to_rgb(h, s, new_v))
if contrast_ratio(candidate, hex_bg) >= min_ratio:
return candidate
else:
new_v = min(1, v + delta)
candidate = rgb_to_hex(*colorsys.hsv_to_rgb(h, s, new_v))
if contrast_ratio(candidate, hex_bg) >= min_ratio:
return candidate
new_v = max(0, v - delta)
candidate = rgb_to_hex(*colorsys.hsv_to_rgb(h, s, new_v))
if contrast_ratio(candidate, hex_bg) >= min_ratio:
return candidate
return hex_color
def generate_palette(base_color, is_light=False, honor_primary=None, background=None):
r, g, b = hex_to_rgb(base_color)
h, s, v = colorsys.rgb_to_hsv(r, g, b)
palette = []
if background:
bg_color = background
palette.append(bg_color)
elif is_light:
bg_color = "#f8f8f8"
palette.append(bg_color)
else:
bg_color = "#1a1a1a"
palette.append(bg_color)
red_h = 0.0
if is_light:
red_color = rgb_to_hex(*colorsys.hsv_to_rgb(red_h, 0.75, 0.85))
palette.append(ensure_contrast(red_color, bg_color, 4.5, is_light))
else:
red_color = rgb_to_hex(*colorsys.hsv_to_rgb(red_h, 0.6, 0.8))
palette.append(ensure_contrast(red_color, bg_color, 4.5, is_light))
green_h = 0.33
if is_light:
green_color = rgb_to_hex(*colorsys.hsv_to_rgb(green_h, max(s * 0.9, 0.75), v * 0.6))
palette.append(ensure_contrast(green_color, bg_color, 4.5, is_light))
else:
green_color = rgb_to_hex(*colorsys.hsv_to_rgb(green_h, max(s * 0.65, 0.5), v * 0.9))
palette.append(ensure_contrast(green_color, bg_color, 4.5, is_light))
yellow_h = 0.08
if is_light:
yellow_color = rgb_to_hex(*colorsys.hsv_to_rgb(yellow_h, max(s * 0.85, 0.7), v * 0.7))
palette.append(ensure_contrast(yellow_color, bg_color, 4.5, is_light))
else:
yellow_color = rgb_to_hex(*colorsys.hsv_to_rgb(yellow_h, max(s * 0.5, 0.45), v * 1.4))
palette.append(ensure_contrast(yellow_color, bg_color, 4.5, is_light))
if is_light:
blue_color = rgb_to_hex(*colorsys.hsv_to_rgb(h, max(s * 0.9, 0.7), v * 1.1))
palette.append(ensure_contrast(blue_color, bg_color, 4.5, is_light))
else:
blue_color = rgb_to_hex(*colorsys.hsv_to_rgb(h, max(s * 0.8, 0.6), min(v * 1.6, 1.0)))
palette.append(ensure_contrast(blue_color, bg_color, 4.5, is_light))
mag_h = h - 0.03 if h >= 0.03 else h + 0.97
if honor_primary:
hr, hg, hb = hex_to_rgb(honor_primary)
hh, hs, hv = colorsys.rgb_to_hsv(hr, hg, hb)
if is_light:
mag_color = rgb_to_hex(*colorsys.hsv_to_rgb(hh, max(hs * 0.9, 0.7), hv * 0.85))
palette.append(ensure_contrast(mag_color, bg_color, 4.5, is_light))
else:
mag_color = rgb_to_hex(*colorsys.hsv_to_rgb(hh, hs * 0.8, hv * 0.75))
palette.append(ensure_contrast(mag_color, bg_color, 4.5, is_light))
elif is_light:
mag_color = rgb_to_hex(*colorsys.hsv_to_rgb(mag_h, max(s * 0.75, 0.6), v * 0.9))
palette.append(ensure_contrast(mag_color, bg_color, 4.5, is_light))
else:
mag_color = rgb_to_hex(*colorsys.hsv_to_rgb(mag_h, max(s * 0.7, 0.6), v * 0.85))
palette.append(ensure_contrast(mag_color, bg_color, 4.5, is_light))
cyan_h = h + 0.08
if honor_primary:
palette.append(ensure_contrast(honor_primary, bg_color, 4.5, is_light))
elif is_light:
cyan_color = rgb_to_hex(*colorsys.hsv_to_rgb(cyan_h, max(s * 0.8, 0.65), v * 1.05))
palette.append(ensure_contrast(cyan_color, bg_color, 4.5, is_light))
else:
cyan_color = rgb_to_hex(*colorsys.hsv_to_rgb(cyan_h, max(s * 0.6, 0.5), min(v * 1.25, 0.85)))
palette.append(ensure_contrast(cyan_color, bg_color, 4.5, is_light))
if is_light:
palette.append("#2e2e2e")
palette.append("#4a4a4a")
else:
palette.append("#abb2bf")
palette.append("#5c6370")
if is_light:
bright_red = rgb_to_hex(*colorsys.hsv_to_rgb(red_h, 0.6, 0.9))
palette.append(ensure_contrast(bright_red, bg_color, 3.0, is_light))
bright_green = rgb_to_hex(*colorsys.hsv_to_rgb(green_h, max(s * 0.8, 0.7), v * 0.65))
palette.append(ensure_contrast(bright_green, bg_color, 3.0, is_light))
bright_yellow = rgb_to_hex(*colorsys.hsv_to_rgb(yellow_h, max(s * 0.75, 0.65), v * 0.75))
palette.append(ensure_contrast(bright_yellow, bg_color, 3.0, is_light))
if honor_primary:
hr, hg, hb = hex_to_rgb(honor_primary)
hh, hs, hv = colorsys.rgb_to_hsv(hr, hg, hb)
bright_blue = rgb_to_hex(*colorsys.hsv_to_rgb(hh, min(hs * 1.1, 1.0), min(hv * 1.2, 1.0)))
palette.append(ensure_contrast(bright_blue, bg_color, 3.0, is_light))
else:
bright_blue = rgb_to_hex(*colorsys.hsv_to_rgb(h, max(s * 0.8, 0.7), min(v * 1.3, 1.0)))
palette.append(ensure_contrast(bright_blue, bg_color, 3.0, is_light))
bright_mag = rgb_to_hex(*colorsys.hsv_to_rgb(mag_h, max(s * 0.9, 0.75), min(v * 1.25, 1.0)))
palette.append(ensure_contrast(bright_mag, bg_color, 3.0, is_light))
bright_cyan = rgb_to_hex(*colorsys.hsv_to_rgb(cyan_h, max(s * 0.75, 0.65), min(v * 1.25, 1.0)))
palette.append(ensure_contrast(bright_cyan, bg_color, 3.0, is_light))
else:
bright_red = rgb_to_hex(*colorsys.hsv_to_rgb(red_h, 0.45, min(1.0, 0.9)))
palette.append(ensure_contrast(bright_red, bg_color, 3.0, is_light))
bright_green = rgb_to_hex(*colorsys.hsv_to_rgb(green_h, max(s * 0.5, 0.4), min(v * 1.5, 0.9)))
palette.append(ensure_contrast(bright_green, bg_color, 3.0, is_light))
bright_yellow = rgb_to_hex(*colorsys.hsv_to_rgb(yellow_h, max(s * 0.4, 0.35), min(v * 1.6, 0.95)))
palette.append(ensure_contrast(bright_yellow, bg_color, 3.0, is_light))
if honor_primary:
hr, hg, hb = hex_to_rgb(honor_primary)
hh, hs, hv = colorsys.rgb_to_hsv(hr, hg, hb)
bright_blue = rgb_to_hex(*colorsys.hsv_to_rgb(hh, min(hs * 1.2, 1.0), min(hv * 1.1, 1.0)))
palette.append(ensure_contrast(bright_blue, bg_color, 3.0, is_light))
else:
bright_blue = rgb_to_hex(*colorsys.hsv_to_rgb(h, max(s * 0.6, 0.5), min(v * 1.5, 0.9)))
palette.append(ensure_contrast(bright_blue, bg_color, 3.0, is_light))
bright_mag = rgb_to_hex(*colorsys.hsv_to_rgb(mag_h, max(s * 0.7, 0.6), min(v * 1.3, 0.9)))
palette.append(ensure_contrast(bright_mag, bg_color, 3.0, is_light))
bright_cyan = rgb_to_hex(*colorsys.hsv_to_rgb(h + 0.02 if h + 0.02 <= 1.0 else h + 0.02 - 1.0, max(s * 0.6, 0.5), min(v * 1.2, 0.85)))
palette.append(ensure_contrast(bright_cyan, bg_color, 3.0, is_light))
if is_light:
palette.append("#1a1a1a")
else:
palette.append("#ffffff")
return palette
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: dank16.py <hex_color> [--light] [--kitty] [--honor-primary HEX] [--background HEX]", file=sys.stderr)
sys.exit(1)
base = sys.argv[1]
if not base.startswith('#'):
base = '#' + base
is_light = "--light" in sys.argv
is_kitty = "--kitty" in sys.argv
honor_primary = None
if "--honor-primary" in sys.argv:
try:
honor_idx = sys.argv.index("--honor-primary")
if honor_idx + 1 < len(sys.argv):
honor_primary = sys.argv[honor_idx + 1]
if not honor_primary.startswith('#'):
honor_primary = '#' + honor_primary
except (ValueError, IndexError):
print("Error: --honor-primary requires a hex color", file=sys.stderr)
sys.exit(1)
background = None
if "--background" in sys.argv:
try:
bg_idx = sys.argv.index("--background")
if bg_idx + 1 < len(sys.argv):
background = sys.argv[bg_idx + 1]
if not background.startswith('#'):
background = '#' + background
except (ValueError, IndexError):
print("Error: --background requires a hex color", file=sys.stderr)
sys.exit(1)
colors = generate_palette(base, is_light, honor_primary, background)
if is_kitty:
# Kitty color format mapping
kitty_colors = [
("color0", colors[0]),
("color1", colors[1]),
("color2", colors[2]),
("color3", colors[3]),
("color4", colors[4]),
("color5", colors[5]),
("color6", colors[6]),
("color7", colors[7]),
("color8", colors[8]),
("color9", colors[9]),
("color10", colors[10]),
("color11", colors[11]),
("color12", colors[12]),
("color13", colors[13]),
("color14", colors[14]),
("color15", colors[15])
]
for name, color in kitty_colors:
print(f"{name} {color}")
else:
for i, color in enumerate(colors):
print(f"palette = {i}={color}")

View File

@@ -0,0 +1,304 @@
{
"$schema": "vscode://schemas/color-theme",
"name": "Dynamic Base16 DankShell",
"type": "dark",
"colors": {
"editor.background": "{{colors.surface.default.hex}}",
"editor.foreground": "{{colors.on_surface.default.hex}}",
"editorLineNumber.foreground": "{{colors.outline.default.hex}}",
"editorLineNumber.activeForeground": "{{colors.on_surface.default.hex}}",
"editorCursor.foreground": "{{colors.primary.default.hex}}",
"editor.selectionBackground": "{{colors.primary_container.default.hex}}",
"editor.inactiveSelectionBackground": "{{colors.surface_container.default.hex}}",
"editor.lineHighlightBackground": "{{colors.surface_container.default.hex}}",
"editorIndentGuide.background": "{{colors.surface_container_high.default.hex}}",
"editorIndentGuide.activeBackground": "{{colors.outline.default.hex}}",
"editorWhitespace.foreground": "{{colors.outline_variant.default.hex}}",
"editorBracketMatch.background": "{{colors.surface_container_high.default.hex}}",
"editorBracketMatch.border": "{{colors.primary.default.hex}}",
"activityBar.background": "{{colors.surface.default.hex}}",
"activityBar.foreground": "{{colors.on_surface.default.hex}}",
"activityBar.activeBorder": "{{colors.primary.default.hex}}",
"activityBar.activeBackground": "{{colors.surface_container.default.hex}}",
"activityBarBadge.background": "{{colors.primary.default.hex}}",
"activityBarBadge.foreground": "{{colors.on_primary.default.hex}}",
"sideBar.background": "{{colors.surface.default.hex}}",
"sideBar.foreground": "{{colors.on_surface.default.hex}}",
"sideBar.border": "{{colors.surface_container.default.hex}}",
"sideBarTitle.foreground": "{{colors.on_surface.default.hex}}",
"sideBarSectionHeader.background": "{{colors.surface_container.default.hex}}",
"sideBarSectionHeader.foreground": "{{colors.on_surface.default.hex}}",
"list.activeSelectionBackground": "{{colors.surface_container_high.default.hex}}",
"list.activeSelectionForeground": "{{colors.on_surface.default.hex}}",
"list.inactiveSelectionBackground": "{{colors.surface_container.default.hex}}",
"list.hoverBackground": "{{colors.surface_container.default.hex}}",
"list.focusBackground": "{{colors.surface_container_high.default.hex}}",
"list.highlightForeground": "{{colors.primary.default.hex}}",
"statusBar.background": "{{colors.surface.default.hex}}",
"statusBar.foreground": "{{colors.on_surface.default.hex}}",
"statusBar.border": "{{colors.surface_container.default.hex}}",
"statusBar.noFolderBackground": "{{colors.surface.default.hex}}",
"statusBar.debuggingBackground": "{{colors.error.default.hex}}",
"statusBar.debuggingForeground": "{{colors.on_error.default.hex}}",
"tab.activeBackground": "{{colors.surface.default.hex}}",
"tab.inactiveBackground": "{{colors.surface_container.default.hex}}",
"tab.activeForeground": "{{colors.on_surface.default.hex}}",
"tab.inactiveForeground": "{{colors.outline.default.hex}}",
"tab.border": "{{colors.surface.default.hex}}",
"tab.activeBorder": "{{colors.primary.default.hex}}",
"tab.unfocusedActiveBorder": "{{colors.outline.default.hex}}",
"editorGroupHeader.tabsBackground": "{{colors.surface_container.default.hex}}",
"editorGroupHeader.noTabsBackground": "{{colors.surface.default.hex}}",
"titleBar.activeBackground": "{{colors.surface.default.hex}}",
"titleBar.activeForeground": "{{colors.on_surface.default.hex}}",
"titleBar.inactiveBackground": "{{colors.surface.default.hex}}",
"titleBar.inactiveForeground": "{{colors.outline.default.hex}}",
"titleBar.border": "{{colors.surface_container.default.hex}}",
"input.background": "{{colors.surface_container.default.hex}}",
"input.foreground": "{{colors.on_surface.default.hex}}",
"input.border": "{{colors.outline.default.hex}}",
"input.placeholderForeground": "{{colors.outline.default.hex}}",
"inputOption.activeBorder": "{{colors.primary.default.hex}}",
"inputValidation.errorBackground": "{{colors.error.default.hex}}",
"inputValidation.errorBorder": "{{colors.error.default.hex}}",
"dropdown.background": "{{colors.surface_container.default.hex}}",
"dropdown.foreground": "{{colors.on_surface.default.hex}}",
"dropdown.border": "{{colors.outline.default.hex}}",
"button.background": "{{colors.primary.default.hex}}",
"button.foreground": "{{colors.on_primary.default.hex}}",
"button.hoverBackground": "{{colors.primary_container.default.hex}}",
"focusBorder": "{{colors.primary.default.hex}}",
"badge.background": "{{colors.secondary.default.hex}}",
"badge.foreground": "{{colors.on_secondary.default.hex}}",
"panel.background": "{{colors.surface.default.hex}}",
"panel.border": "{{colors.surface_container.default.hex}}",
"panelTitle.activeBorder": "{{colors.primary.default.hex}}",
"panelTitle.activeForeground": "{{colors.on_surface.default.hex}}",
"panelTitle.inactiveForeground": "{{colors.outline.default.hex}}",
"terminal.background": "{{colors.surface.default.hex}}",
"terminal.foreground": "{{colors.on_surface.default.hex}}",
"gitDecoration.modifiedResourceForeground": "{{colors.tertiary.default.hex}}",
"gitDecoration.deletedResourceForeground": "{{colors.error.default.hex}}",
"gitDecoration.untrackedResourceForeground": "{{colors.secondary.default.hex}}",
"gitDecoration.ignoredResourceForeground": "{{colors.outline.default.hex}}",
"gitDecoration.conflictingResourceForeground": "{{colors.error_container.default.hex}}",
"editorWidget.background": "{{colors.surface_container.default.hex}}",
"editorWidget.border": "{{colors.outline.default.hex}}",
"editorSuggestWidget.background": "{{colors.surface_container.default.hex}}",
"editorSuggestWidget.border": "{{colors.outline.default.hex}}",
"editorSuggestWidget.selectedBackground": "{{colors.surface_container_high.default.hex}}",
"editorSuggestWidget.highlightForeground": "{{colors.primary.default.hex}}",
"peekView.border": "{{colors.primary.default.hex}}",
"peekViewEditor.background": "{{colors.surface_container.default.hex}}",
"peekViewResult.background": "{{colors.surface_container.default.hex}}",
"peekViewTitle.background": "{{colors.surface_container.default.hex}}",
"notificationCenter.border": "{{colors.outline.default.hex}}",
"notifications.background": "{{colors.surface_container.default.hex}}",
"notifications.border": "{{colors.outline.default.hex}}",
"breadcrumb.foreground": "{{colors.outline.default.hex}}",
"breadcrumb.focusForeground": "{{colors.on_surface.default.hex}}",
"breadcrumb.activeSelectionForeground": "{{colors.primary.default.hex}}",
"scrollbarSlider.background": "{{colors.outline.default.hex}}40",
"scrollbarSlider.hoverBackground": "{{colors.outline.default.hex}}60",
"scrollbarSlider.activeBackground": "{{colors.outline.default.hex}}80",
"editorError.foreground": "{{colors.error.default.hex}}",
"editorWarning.foreground": "{{colors.tertiary.default.hex}}",
"editorInfo.foreground": "{{colors.primary.default.hex}}",
"editorGutter.addedBackground": "{{colors.secondary.default.hex}}",
"editorGutter.modifiedBackground": "{{colors.tertiary.default.hex}}",
"editorGutter.deletedBackground": "{{colors.error.default.hex}}",
"diffEditor.insertedTextBackground": "{{colors.secondary.default.hex}}20",
"diffEditor.removedTextBackground": "{{colors.error.default.hex}}20",
"merge.currentHeaderBackground": "{{colors.primary.default.hex}}40",
"merge.incomingHeaderBackground": "{{colors.secondary.default.hex}}40",
"menubar.selectionBackground": "{{colors.surface_container_high.default.hex}}",
"menu.background": "{{colors.surface_container.default.hex}}",
"menu.foreground": "{{colors.on_surface.default.hex}}",
"menu.selectionBackground": "{{colors.surface_container_high.default.hex}}",
"menu.selectionForeground": "{{colors.on_surface.default.hex}}",
"debugToolBar.background": "{{colors.surface_container.default.hex}}",
"debugExceptionWidget.background": "{{colors.surface_container.default.hex}}",
"debugExceptionWidget.border": "{{colors.error.default.hex}}"
},
"tokenColors": [
{
"scope": ["comment", "punctuation.definition.comment"],
"settings": {
"foreground": "{{colors.outline.default.hex}}",
"fontStyle": "italic"
}
},
{
"scope": ["keyword", "storage.type", "storage.modifier"],
"settings": {
"foreground": "{{colors.primary.default.hex}}"
}
},
{
"scope": ["variable", "meta.object-literal.key"],
"settings": {
"foreground": "{{colors.on_surface.default.hex}}"
}
},
{
"scope": ["string", "constant.other.symbol"],
"settings": {
"foreground": "{{colors.secondary.default.hex}}"
}
},
{
"scope": ["constant.numeric", "constant.language", "constant.character"],
"settings": {
"foreground": "{{colors.tertiary.default.hex}}"
}
},
{
"scope": ["entity.name.type", "support.type", "entity.name.class"],
"settings": {
"foreground": "{{colors.tertiary.default.hex}}"
}
},
{
"scope": ["entity.name.function", "support.function"],
"settings": {
"foreground": "{{colors.primary.default.hex}}"
}
},
{
"scope": ["support.class", "support.variable", "variable.language"],
"settings": {
"foreground": "{{colors.secondary.default.hex}}"
}
},
{
"scope": ["invalid"],
"settings": {
"foreground": "{{colors.error.default.hex}}"
}
},
{
"scope": ["invalid.deprecated"],
"settings": {
"foreground": "{{colors.outline.default.hex}}"
}
},
{
"scope": ["markup.heading"],
"settings": {
"foreground": "{{colors.primary.default.hex}}",
"fontStyle": "bold"
}
},
{
"scope": ["markup.bold"],
"settings": {
"foreground": "{{colors.tertiary.default.hex}}",
"fontStyle": "bold"
}
},
{
"scope": ["markup.italic"],
"settings": {
"foreground": "{{colors.primary.default.hex}}",
"fontStyle": "italic"
}
},
{
"scope": ["markup.underline"],
"settings": {
"fontStyle": "underline"
}
},
{
"scope": ["markup.quote"],
"settings": {
"foreground": "{{colors.secondary.default.hex}}"
}
},
{
"scope": ["markup.list"],
"settings": {
"foreground": "{{colors.on_surface.default.hex}}"
}
},
{
"scope": ["markup.raw", "markup.inline.raw"],
"settings": {
"foreground": "{{colors.secondary.default.hex}}"
}
}
],
"semanticHighlighting": true,
"semanticTokenColors": {
"variable.readonly": {
"foreground": "{{colors.tertiary.default.hex}}"
},
"property": {
"foreground": "{{colors.on_surface.default.hex}}"
},
"function": {
"foreground": "{{colors.primary.default.hex}}"
},
"method": {
"foreground": "{{colors.primary.default.hex}}"
},
"type": {
"foreground": "{{colors.tertiary.default.hex}}"
},
"class": {
"foreground": "{{colors.tertiary.default.hex}}"
},
"enumMember": {
"foreground": "{{colors.tertiary.default.hex}}"
},
"string": {
"foreground": "{{colors.secondary.default.hex}}"
},
"number": {
"foreground": "{{colors.tertiary.default.hex}}"
},
"comment": {
"foreground": "{{colors.outline.default.hex}}",
"fontStyle": "italic"
},
"keyword": {
"foreground": "{{colors.primary.default.hex}}"
},
"operator": {
"foreground": "{{colors.on_surface.default.hex}}"
},
"parameter": {
"foreground": "{{colors.on_surface.default.hex}}"
},
"namespace": {
"foreground": "{{colors.secondary.default.hex}}"
}
}
}

View File

@@ -0,0 +1,31 @@
{
"name": "dynamic-base16-dankshell",
"displayName": "Dynamic Base16 DankShell",
"publisher": "local",
"version": "0.0.1",
"engines": {
"vscode": "^1.70.0"
},
"categories": [
"Themes"
],
"contributes": {
"themes": [
{
"label": "Dynamic Base16 DankShell",
"uiTheme": "vs-dark",
"path": "./themes/dankshell-default.json"
},
{
"label": "Dynamic Base16 DankShell (Dark)",
"uiTheme": "vs-dark",
"path": "./themes/dankshell-dark.json"
},
{
"label": "Dynamic Base16 DankShell (Light)",
"uiTheme": "vs",
"path": "./themes/dankshell-light.json"
}
]
}
}

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Language="en-US" Id="dynamic-base16-dankshell" Version="0.0.1" Publisher="local" />
<DisplayName>Dynamic Base16 DankShell</DisplayName>
<Description xml:space="preserve">Dynamic Material You theme with base16 terminal colors</Description>
<Categories>Themes</Categories>
<Properties>
<Property Id="Microsoft.VisualStudio.Code.Engine" Value="^1.70.0" />
<Property Id="Microsoft.VisualStudio.Code.ExtensionKind" Value="ui,workspace" />
</Properties>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Code"/>
</Installation>
<Dependencies/>
<Assets>
<Asset Type="Microsoft.VisualStudio.Code.Manifest" Path="package.json" Addressable="true" />
</Assets>
</PackageManifest>

View File

@@ -254,7 +254,13 @@ EOF
sed -i "s|input_path = './matugen/templates/|input_path = '${CONTENT_TEMPLATES_PATH}|g" "$TMP_CONTENT_CFG" sed -i "s|input_path = './matugen/templates/|input_path = '${CONTENT_TEMPLATES_PATH}|g" "$TMP_CONTENT_CFG"
echo "" >> "$TMP_CONTENT_CFG" echo "" >> "$TMP_CONTENT_CFG"
fi fi
if command -v code >/dev/null 2>&1; then
cat "$SHELL_DIR/matugen/configs/vscode.toml" >> "$TMP_CONTENT_CFG"
sed -i "s|input_path = './matugen/templates/|input_path = '${CONTENT_TEMPLATES_PATH}|g" "$TMP_CONTENT_CFG"
echo "" >> "$TMP_CONTENT_CFG"
fi
if [[ -s "$TMP_CONTENT_CFG" ]] && grep -q '\[templates\.' "$TMP_CONTENT_CFG"; then if [[ -s "$TMP_CONTENT_CFG" ]] && grep -q '\[templates\.' "$TMP_CONTENT_CFG"; then
case "$kind" in case "$kind" in
image) image)
@@ -308,7 +314,7 @@ EOF
fi fi
if command -v ghostty >/dev/null 2>&1 && [[ -f "$CONFIG_DIR/ghostty/config-dankcolors" ]]; then if command -v ghostty >/dev/null 2>&1 && [[ -f "$CONFIG_DIR/ghostty/config-dankcolors" ]]; then
OUT=$("$SHELL_DIR/matugen/dank16.py" "$PRIMARY" $([[ "$mode" == "light" ]] && echo --light) ${HONOR:+--honor-primary "$HONOR"} ${SURFACE:+--background "$SURFACE"} 2>/dev/null || true) OUT=$(dms dank16 "$PRIMARY" $([[ "$mode" == "light" ]] && echo --light) ${HONOR:+--honor-primary "$HONOR"} ${SURFACE:+--background "$SURFACE"} 2>/dev/null || true)
if [[ -n "${OUT:-}" ]]; then if [[ -n "${OUT:-}" ]]; then
TMP="$(mktemp)" TMP="$(mktemp)"
printf "%s\n\n" "$OUT" > "$TMP" printf "%s\n\n" "$OUT" > "$TMP"
@@ -321,7 +327,7 @@ EOF
fi fi
if command -v kitty >/dev/null 2>&1 && [[ -f "$CONFIG_DIR/kitty/dank-theme.conf" ]]; then if command -v kitty >/dev/null 2>&1 && [[ -f "$CONFIG_DIR/kitty/dank-theme.conf" ]]; then
OUT=$("$SHELL_DIR/matugen/dank16.py" "$PRIMARY" $([[ "$mode" == "light" ]] && echo --light) ${HONOR:+--honor-primary "$HONOR"} ${SURFACE:+--background "$SURFACE"} --kitty 2>/dev/null || true) OUT=$(dms dank16 "$PRIMARY" $([[ "$mode" == "light" ]] && echo --light) ${HONOR:+--honor-primary "$HONOR"} ${SURFACE:+--background "$SURFACE"} --kitty 2>/dev/null || true)
if [[ -n "${OUT:-}" ]]; then if [[ -n "${OUT:-}" ]]; then
TMP="$(mktemp)" TMP="$(mktemp)"
printf "%s\n\n" "$OUT" > "$TMP" printf "%s\n\n" "$OUT" > "$TMP"
@@ -333,6 +339,30 @@ EOF
fi fi
fi fi
if command -v code >/dev/null 2>&1; then
VSCODE_EXT_DIR="$HOME/.vscode/extensions/local.dynamic-base16-dankshell-0.0.1"
VSCODE_THEME_DIR="$VSCODE_EXT_DIR/themes"
VSCODE_BASE_THEME="$VSCODE_THEME_DIR/dankshell-color-theme-base.json"
VSCODE_FINAL_THEME="$VSCODE_THEME_DIR/dankshell-color-theme.json"
mkdir -p "$VSCODE_THEME_DIR"
cp "$SHELL_DIR/matugen/templates/vscode-package.json" "$VSCODE_EXT_DIR/package.json"
cp "$SHELL_DIR/matugen/templates/vscode-vsixmanifest.xml" "$VSCODE_EXT_DIR/.vsixmanifest"
for variant in default dark light; do
VSCODE_BASE="$VSCODE_THEME_DIR/dankshell-${variant}-base.json"
VSCODE_FINAL="$VSCODE_THEME_DIR/dankshell-${variant}.json"
if [[ -f "$VSCODE_BASE" ]]; then
VARIANT_LIGHT=""
[[ "$variant" == "light" ]] && VARIANT_LIGHT="--light"
dms dank16 "$PRIMARY" $VARIANT_LIGHT ${HONOR:+--honor-primary "$HONOR"} ${SURFACE:+--background "$SURFACE"} --vscode-enrich "$VSCODE_BASE" > "$VSCODE_FINAL" 2>/dev/null || cp "$VSCODE_BASE" "$VSCODE_FINAL"
fi
done
fi
set_system_color_scheme "$mode" set_system_color_scheme "$mode"
} }