1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-05 21:15:38 -05:00

matugen: package vscode theme as vsix

This commit is contained in:
bbedward
2025-12-04 09:39:29 -05:00
parent 44190f07fe
commit 879102599c
12 changed files with 191 additions and 106 deletions

View File

@@ -1,11 +0,0 @@
[templates.dmscodiumdefault]
input_path = 'SHELL_DIR/matugen/templates/vscode-color-theme-default.json'
output_path = '~/.vscode-oss/extensions/local.dynamic-base16-dankshell-0.0.1/themes/dankshell-default.json'
[templates.dmscodiumdark]
input_path = 'SHELL_DIR/matugen/templates/vscode-color-theme-dark.json'
output_path = '~/.vscode-oss/extensions/local.dynamic-base16-dankshell-0.0.1/themes/dankshell-dark.json'
[templates.dmscodiumlight]
input_path = 'SHELL_DIR/matugen/templates/vscode-color-theme-light.json'
output_path = '~/.vscode-oss/extensions/local.dynamic-base16-dankshell-0.0.1/themes/dankshell-light.json'

View File

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

Binary file not shown.

View File

@@ -1,20 +0,0 @@
<?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

@@ -0,0 +1,5 @@
# Changelog
## 1.0.0
- Initial release

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 DankLinux
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,17 @@
# Dynamic Base16 DankShell Theme
A VSCode theme for [DankMaterialShell](https://github.com/EverydayCodeAlchemy/DankMaterialShellGit).
## How It Works
1. Install this extension
2. Select one of the "Dynamic Base16 DankShell" themes in VSCode
3. DankMaterialShell automatically updates the theme files when you change themes.
The theme files are located in your VSCode extensions directory and are updated by matugen when generating new colors.
## Themes
- **Dynamic Base16 DankShell** - Follows your current light/dark mode
- **Dynamic Base16 DankShell (Dark)** - Always dark variant
- **Dynamic Base16 DankShell (Light)** - Always light variant

View File

@@ -1,6 +1,7 @@
{ {
"name": "dynamic-base16-dankshell", "name": "dynamic-base16-dankshell",
"displayName": "Dynamic Base16 DankShell", "displayName": "Dynamic Base16 DankShell",
"description": "Dynamic Material You theme with base16 terminal colors - auto-updated by DankMaterialShell",
"publisher": "local", "publisher": "local",
"version": "0.0.1", "version": "0.0.1",
"engines": { "engines": {
@@ -9,6 +10,18 @@
"categories": [ "categories": [
"Themes" "Themes"
], ],
"keywords": [
"theme",
"material",
"material you",
"base16",
"dynamic",
"dankshell"
],
"repository": {
"type": "git",
"url": "https://github.com/AvengeMedia/DankMaterialShellGit"
},
"contributes": { "contributes": {
"themes": [ "themes": [
{ {

View File

@@ -0,0 +1,36 @@
{
"$schema": "vscode://schemas/color-theme",
"name": "Dynamic Base16 DankShell",
"colors": {
"editor.background": "#1a1a2e",
"editor.foreground": "#e4e4e7",
"editorLineNumber.foreground": "#71717a",
"editorLineNumber.activeForeground": "#e4e4e7",
"editorCursor.foreground": "#a78bfa",
"editor.selectionBackground": "#4c1d95",
"activityBar.background": "#1a1a2e",
"activityBar.foreground": "#e4e4e7",
"activityBarBadge.background": "#a78bfa",
"activityBarBadge.foreground": "#1a1a2e",
"sideBar.background": "#1a1a2e",
"sideBar.foreground": "#e4e4e7",
"statusBar.background": "#1a1a2e",
"statusBar.foreground": "#e4e4e7",
"titleBar.activeBackground": "#1a1a2e",
"titleBar.activeForeground": "#e4e4e7"
},
"tokenColors": [
{
"scope": ["comment"],
"settings": { "foreground": "#71717a", "fontStyle": "italic" }
},
{
"scope": ["keyword"],
"settings": { "foreground": "#a78bfa" }
},
{
"scope": ["string"],
"settings": { "foreground": "#34d399" }
}
]
}

View File

@@ -0,0 +1,36 @@
{
"$schema": "vscode://schemas/color-theme",
"name": "Dynamic Base16 DankShell",
"colors": {
"editor.background": "#1a1a2e",
"editor.foreground": "#e4e4e7",
"editorLineNumber.foreground": "#71717a",
"editorLineNumber.activeForeground": "#e4e4e7",
"editorCursor.foreground": "#a78bfa",
"editor.selectionBackground": "#4c1d95",
"activityBar.background": "#1a1a2e",
"activityBar.foreground": "#e4e4e7",
"activityBarBadge.background": "#a78bfa",
"activityBarBadge.foreground": "#1a1a2e",
"sideBar.background": "#1a1a2e",
"sideBar.foreground": "#e4e4e7",
"statusBar.background": "#1a1a2e",
"statusBar.foreground": "#e4e4e7",
"titleBar.activeBackground": "#1a1a2e",
"titleBar.activeForeground": "#e4e4e7"
},
"tokenColors": [
{
"scope": ["comment"],
"settings": { "foreground": "#71717a", "fontStyle": "italic" }
},
{
"scope": ["keyword"],
"settings": { "foreground": "#a78bfa" }
},
{
"scope": ["string"],
"settings": { "foreground": "#34d399" }
}
]
}

View File

@@ -0,0 +1,36 @@
{
"$schema": "vscode://schemas/color-theme",
"name": "Dynamic Base16 DankShell",
"colors": {
"editor.background": "#1a1a2e",
"editor.foreground": "#e4e4e7",
"editorLineNumber.foreground": "#71717a",
"editorLineNumber.activeForeground": "#e4e4e7",
"editorCursor.foreground": "#a78bfa",
"editor.selectionBackground": "#4c1d95",
"activityBar.background": "#1a1a2e",
"activityBar.foreground": "#e4e4e7",
"activityBarBadge.background": "#a78bfa",
"activityBarBadge.foreground": "#1a1a2e",
"sideBar.background": "#1a1a2e",
"sideBar.foreground": "#e4e4e7",
"statusBar.background": "#1a1a2e",
"statusBar.foreground": "#e4e4e7",
"titleBar.activeBackground": "#1a1a2e",
"titleBar.activeForeground": "#e4e4e7"
},
"tokenColors": [
{
"scope": ["comment"],
"settings": { "foreground": "#71717a", "fontStyle": "italic" }
},
{
"scope": ["keyword"],
"settings": { "foreground": "#a78bfa" }
},
{
"scope": ["string"],
"settings": { "foreground": "#34d399" }
}
]
}

View File

@@ -73,6 +73,27 @@ append_config() {
echo "" >> "$cfg_file" echo "" >> "$cfg_file"
} }
append_vscode_config() {
local name="$1" ext_dir="$2" cfg_file="$3"
[[ ! -d "$ext_dir" ]] && return
local template_dir="$SHELL_DIR/matugen/templates"
cat >> "$cfg_file" << EOF
[templates.dms${name}default]
input_path = '$template_dir/vscode-color-theme-default.json'
output_path = '$ext_dir/themes/dankshell-default.json'
[templates.dms${name}dark]
input_path = '$template_dir/vscode-color-theme-dark.json'
output_path = '$ext_dir/themes/dankshell-dark.json'
[templates.dms${name}light]
input_path = '$template_dir/vscode-color-theme-light.json'
output_path = '$ext_dir/themes/dankshell-light.json'
EOF
log "Added $name theme config (extension found at $ext_dir)"
}
build_merged_config() { build_merged_config() {
local mode="$1" run_user="$2" cfg_file="$3" local mode="$1" run_user="$2" cfg_file="$3"
@@ -107,8 +128,12 @@ EOF
append_config "alacritty" "alacritty.toml" "$cfg_file" append_config "alacritty" "alacritty.toml" "$cfg_file"
append_config "wezterm" "wezterm.toml" "$cfg_file" append_config "wezterm" "wezterm.toml" "$cfg_file"
append_config "dgop" "dgop.toml" "$cfg_file" append_config "dgop" "dgop.toml" "$cfg_file"
append_config "code" "vscode.toml" "$cfg_file"
append_config "codium" "codium.toml" "$cfg_file" append_vscode_config "vscode" "$HOME/.vscode/extensions/local.dynamic-base16-dankshell-0.0.1" "$cfg_file"
append_vscode_config "codium" "$HOME/.vscode-oss/extensions/local.dynamic-base16-dankshell-0.0.1" "$cfg_file"
append_vscode_config "codeoss" "$HOME/.config/Code - OSS/extensions/local.dynamic-base16-dankshell-0.0.1" "$cfg_file"
append_vscode_config "cursor" "$HOME/.cursor/extensions/local.dynamic-base16-dankshell-0.0.1" "$cfg_file"
append_vscode_config "windsurf" "$HOME/.windsurf/extensions/local.dynamic-base16-dankshell-0.0.1" "$cfg_file"
if [[ "$run_user" == "true" && -f "$CONFIG_DIR/matugen/config.toml" ]]; then if [[ "$run_user" == "true" && -f "$CONFIG_DIR/matugen/config.toml" ]]; then
awk '/^\[templates\]/{p=1} p' "$CONFIG_DIR/matugen/config.toml" >> "$cfg_file" awk '/^\[templates\]/{p=1} p' "$CONFIG_DIR/matugen/config.toml" >> "$cfg_file"
@@ -167,66 +192,6 @@ refresh_gtk() {
gsettings set org.gnome.desktop.interface gtk-theme "adw-gtk3-${mode}" 2>/dev/null || true gsettings set org.gnome.desktop.interface gtk-theme "adw-gtk3-${mode}" 2>/dev/null || true
} }
setup_vscode_extension() {
local cmd="$1" ext_dir="$2" config_dir="$3"
command -v "$cmd" >/dev/null 2>&1 || return
[[ ! -d "$config_dir" ]] && return
local theme_dir="$ext_dir/themes"
mkdir -p "$theme_dir"
cp "$SHELL_DIR/matugen/templates/vscode-package.json" "$ext_dir/package.json" 2>/dev/null || true
cp "$SHELL_DIR/matugen/templates/vscode-vsixmanifest.xml" "$ext_dir/.vsixmanifest" 2>/dev/null || true
update_vscode_extensions_json "$config_dir/extensions" "$ext_dir"
}
update_vscode_extensions_json() {
local ext_list_dir="$1" ext_dir="$2"
local ext_json="$ext_list_dir/extensions.json"
[[ ! -f "$ext_json" ]] && return
grep -q "dynamic-base16-dankshell" "$ext_json" && return
cp "$ext_json" "$ext_json.bak"
local entry
entry=$(cat <<EOF
{
"identifier": {
"id": "local.dynamic-base16-dankshell",
"uuid": "00000000-0000-0000-0000-000000000000"
},
"version": "0.0.1",
"location": {
"\$mid": 1,
"path": "$ext_dir",
"scheme": "file"
},
"relativeLocation": "local.dynamic-base16-dankshell-0.0.1",
"metadata": {
"isApplicationScoped": false,
"isMachineScoped": false,
"isBuiltin": false,
"installedTimestamp": $(date +%s)000,
"pinned": false,
"source": "local",
"id": "00000000-0000-0000-0000-000000000000",
"publisherId": "local",
"publisherDisplayName": "Dank Linux",
"targetPlatform": "undefined",
"updated": true,
"private": false,
"isPreReleaseVersion": false,
"hasPreReleaseVersion": false,
"preRelease": false
}
}
EOF
)
local content
content=$(cat "$ext_json")
if [[ "$content" == "[]" ]]; then
echo "[$entry]" > "$ext_json"
else
echo "${content%]}, $entry]" > "$ext_json"
fi
}
signal_terminals() { signal_terminals() {
pgrep -x kitty >/dev/null 2>&1 && pkill -USR1 kitty pgrep -x kitty >/dev/null 2>&1 && pkill -USR1 kitty
pgrep -x ghostty >/dev/null 2>&1 && pkill -USR2 ghostty pgrep -x ghostty >/dev/null 2>&1 && pkill -USR2 ghostty
@@ -308,8 +273,6 @@ build_once() {
fi fi
refresh_gtk "$mode" refresh_gtk "$mode"
setup_vscode_extension "code" "$HOME/.vscode/extensions/local.dynamic-base16-dankshell-0.0.1" "$HOME/.vscode"
setup_vscode_extension "codium" "$HOME/.vscode-oss/extensions/local.dynamic-base16-dankshell-0.0.1" "$HOME/.vscode-oss"
signal_terminals signal_terminals
return 0 return 0