Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Validate themes

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

concurrency:
group: validate-${{ github.ref }}
cancel-in-progress: true

jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install validation tools
run: python -m pip install PyYAML==6.0.2

- name: Regenerate theme files
run: |
python3 yasb/generate.py
python3 zebar/generate-palettes.py
python3 windhawk/taskbar/generate.py

- name: Check generated files are committed
run: |
git diff --exit-code
test -z "$(git status --porcelain)"

- name: Validate assets and documentation
run: python3 scripts/validate.py

- name: Validate PowerShell syntax
run: |
pwsh -NoProfile -Command '
$failed = $false
Get-ChildItem -Recurse -Filter *.ps1 | ForEach-Object {
$tokens = $null
$errors = $null
[System.Management.Automation.Language.Parser]::ParseFile($_.FullName, [ref]$tokens, [ref]$errors) | Out-Null
if ($errors.Count -gt 0) {
Write-Host "Syntax errors in $($_.FullName)"
$errors | ForEach-Object { Write-Host $_ }
$failed = $true
}
}
if ($failed) { exit 1 }
'
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ Xscriptor palette ecosystem.
the app if missing and deploy the theme packs from the repo:

```powershell
irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/windows/yasb/install.ps1 | iex # YASB only
irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/windows/zebar/install.ps1 | iex # Zebar only
irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/yasb/install.ps1 | iex # YASB only
irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/zebar/install.ps1 | iex # Zebar only
```

**Or clone and deploy locally**:
Expand Down
106 changes: 106 additions & 0 deletions scripts/validate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
#!/usr/bin/env python3
"""Validate Windows theme assets and documentation links.

Checks JSON and YAML syntax and verifies that relative Markdown links resolve.
PowerShell syntax is validated separately in CI with the PowerShell parser.
"""

from __future__ import annotations

import json
import re
import sys
from pathlib import Path
from urllib.parse import unquote, urlparse

try:
import yaml
except ImportError: # pragma: no cover - local convenience
yaml = None

ROOT = Path(__file__).resolve().parents[1]
SKIP_DIRS = {".git", "__pycache__"}
LINK_RE = re.compile(r"(?<!\!)\[[^\]]*\]\(([^)]+)\)")
HREF_RE = re.compile(r'href=["\']([^"\']+)["\']')


def iter_files(suffix: str) -> list[Path]:
files = []
for path in ROOT.rglob(f"*{suffix}"):
if path.is_file() and not any(part in SKIP_DIRS for part in path.relative_to(ROOT).parts):
files.append(path)
return sorted(files)


def check_json(path: Path) -> str | None:
try:
with path.open(encoding="utf-8") as f:
json.load(f)
except (OSError, json.JSONDecodeError) as exc:
return f"{path.relative_to(ROOT)}: {exc}"
return None


def check_yaml(path: Path) -> str | None:
if yaml is None:
return None
try:
with path.open(encoding="utf-8") as f:
yaml.safe_load(f)
except (OSError, yaml.YAMLError) as exc:
return f"{path.relative_to(ROOT)}: {exc}"
return None


def check_links(path: Path) -> list[str]:
issues = []
text = path.read_text(encoding="utf-8", errors="replace")
for raw in LINK_RE.findall(text) + HREF_RE.findall(text):
target = unquote(raw.strip().split(" ", 1)[0])
parsed = urlparse(target)
if parsed.scheme or target.startswith(("#", "//", "/")):
continue
clean = target.split("#", 1)[0].split("?", 1)[0]
if not clean:
continue
destination = (path.parent / clean).resolve()
try:
destination.relative_to(ROOT.resolve())
except ValueError:
continue
if not destination.exists():
issues.append(f"{path.relative_to(ROOT)}: broken link {target!r}")
return issues


def main() -> int:
errors: list[str] = []
checked = 0

for path in iter_files(".json"):
checked += 1
error = check_json(path)
if error:
errors.append(error)
for path in iter_files(".yaml") + iter_files(".yml"):
checked += 1
error = check_yaml(path)
if error:
errors.append(error)
for path in iter_files(".md"):
checked += 1
errors.extend(check_links(path))

print(f"Validated {checked} files.")
if errors:
print("\nValidation failed:", file=sys.stderr)
for error in errors:
print(f" {error}", file=sys.stderr)
return 1

print("All checked files are valid.")
return 0


if __name__ == "__main__":
sys.exit(main())
96 changes: 13 additions & 83 deletions windhawk/taskbar/generate.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/usr/bin/env python3
"""Generate windhawk/taskbar/xscriptor/*.json from the canonical PALETTES.
"""Generate windhawk/taskbar/dock/*.json from the canonical PALETTES.

Base: the xdark taskbar style (rounded 13px buttons) remapped per palette —
the gold accent (#facc15) is replaced by each palette's own differentiating
color on the clock, tray text, labels, running indicator and foregrounds,
and the solid black button/tray backgrounds are replaced by each palette's
`background` color. The Start button is hidden in every variant.
Dock-style taskbar themes: a floating centered pill, with each palette's
accent on borders, running indicator and labels, and its `background` color
behind the pill. The Start button is hidden in every variant.

The transparent glass layout is kept as a one-off copy in glassx.json (not
touched by this script). Usage: python generate.py
Expand All @@ -18,8 +16,6 @@
HERE = os.path.dirname(os.path.abspath(__file__))
REPO = os.path.dirname(os.path.dirname(HERE))
GEN = os.path.join(REPO, "yasb", "generate.py")
OUT_DIR = os.path.join(HERE, "xscriptor")

spec = importlib.util.spec_from_file_location("yasb_gen", GEN)
yasb = importlib.util.module_from_spec(spec)
spec.loader.exec_module(yasb)
Expand All @@ -43,66 +39,6 @@
"bogota": "#47e6ff",
}

# xdark base template, with $accent in place of the gold #facc15 and the
# Start button collapsed (no Windows icon).
TEMPLATE = {
"theme": "xdark",
"controlStyles[0].target": "Taskbar.TaskListButton",
"controlStyles[0].styles[0]": "CornerRadius=13",
"controlStyles[0].styles[1]": "Padding=6,0,6,0",
"controlStyles[0].styles[2]": "HorizontalContentAlignment=Left",
"resourceVariables[0].variableKey": "",
"resourceVariables[0].value": "",
"controlStyles[1].target": "SystemTray.TextIconContent > Grid#ContainerGrid > SystemTray.AdaptiveTextBlock#Base > TextBlock#InnerTextBlock",
"controlStyles[1].styles[0]": "FontSize=16",
"controlStyles[1].styles[1]": "Foreground=$accent",
"controlStyles[2].target": "SystemTray.NotifyIconView#NotifyItemIcon",
"controlStyles[2].styles[0]": "MinWidth=25",
"controlStyles[3].target": "SystemTray.OmniButton#ControlCenterButton > Grid > ContentPresenter > ItemsPresenter > StackPanel > ContentPresenter[1] > SystemTray.IconView > Grid > Grid",
"controlStyles[3].styles[0]": "Visibility=Collapsed",
"controlStyles[4].target": "SystemTray.TextIconContent > Grid#ContainerGrid",
"controlStyles[4].styles[0]": "Padding=2",
"controlStyles[5].target": "SystemTray.ChevronIconView",
"controlStyles[5].styles[0]": "MinWidth=27",
"controlStyles[6].target": "SystemTray.OmniButton#NotificationCenterButton > Grid > ContentPresenter > ItemsPresenter > StackPanel > ContentPresenter > SystemTray.IconView#SystemTrayIcon > Grid > Grid > SystemTray.TextIconContent",
"controlStyles[6].styles[0]": "Visibility=Collapsed",
"controlStyles[7].target": "Taskbar.TaskListLabeledButtonPanel > Border#BackgroundElement",
"controlStyles[7].styles[0]": "Background=$bg",
"controlStyles[8].target": "Grid#SystemTrayFrameGrid",
"controlStyles[8].styles[0]": "Background=$bg",
"controlStyles[8].styles[1]": "CornerRadius=13",
"controlStyles[8].styles[2]": "Margin=0,5,4,5",
"controlStyles[8].styles[3]": "Padding=2,0,-18,0",
"controlStyles[9].target": "Taskbar.TaskListButton > Grid > Rectangle#RunningIndicator",
"controlStyles[9].styles[0]": "Height=3",
"controlStyles[9].styles[1]": "RadiusX=1.5",
"controlStyles[9].styles[2]": "RadiusY=1.5",
"controlStyles[9].styles[3]": "Fill@ActiveNormal=$accent",
"controlStyles[9].styles[4]": "VerticalAlignment=Bottom",
"controlStyles[9].styles[5]": "Margin=16,0,16,4",
"controlStyles[9].styles[6]": "StrokeThickness=0",
"controlStyles[10].target": "SystemTray.ImageIconContent > Grid#ContainerGrid > Image",
"controlStyles[10].styles[0]": "Width=13",
"controlStyles[11].target": "SystemTray.TextIconContent > Grid#ContainerGrid > SystemTray.AdaptiveTextBlock#Base > TextBlock#InnerTextBlock",
"controlStyles[11].styles[0]": "FontSize=13",
"controlStyles[11].styles[1]": "Foreground=$accent",
"controlStyles[12].target": "TextBlock#LabelControl",
"controlStyles[12].styles[0]": "FontFamily=Segoe UI Medium",
"controlStyles[12].styles[1]": "Foreground=$accent",
"controlStyles[12].styles[2]": "Margin=1,0,0,0",
"controlStyles[12].styles[3]": "VerticalAlignment=Center",
"controlStyles[12].styles[4]": "TextWrapping=NoWrap",
"controlStyles[13].target": "Taskbar.ExperienceToggleButton#LaunchListButton[AutomationProperties.AutomationId=StartButton]",
"controlStyles[13].styles[0]": "Visibility=Collapsed",
"controlStyles[15].target": "Taskbar.TaskbarFrame > Grid#RootGrid > Taskbar.TaskbarBackground > Grid > Rectangle#BackgroundFill",
"controlStyles[15].styles[0]": "Fill=Transparent",
"controlStyles[16].target": "Rectangle#BackgroundStroke",
"controlStyles[16].styles[0]": "Fill=Transparent",
"controlStyles[18].target": "SystemTray.TextIconContent > Grid#ContainerGrid > SystemTray.AdaptiveTextBlock#Base > TextBlock#InnerTextBlock",
"controlStyles[18].styles[0]": "Foreground=$accent",
}


X_BG = "#050505" # X is the hand-tuned base palette.

# Dock-like template (apps sit on a floating centered pill, no button boxes),
Expand Down Expand Up @@ -166,9 +102,9 @@ def with_alpha(color, alpha):


def main():
os.makedirs(OUT_DIR, exist_ok=True)
dock_dir = os.path.join(HERE, "dock")
os.makedirs(dock_dir, exist_ok=True)

for pid in ORDER:
accent = ACCENTS[pid]
bg = X_BG if pid == "x" else yasb.PALETTES[pid]["background"]
Expand All @@ -178,20 +114,14 @@ def main():
"$accent": accent,
"$bg": bg,
}
for name, template, out_dir in (
("xdark", TEMPLATE, OUT_DIR),
("dock", DOCK_TEMPLATE, dock_dir),
):
data = {
key: value for key, value in template.items()
}
for token, color in ctx.items():
data = {key: value.replace(token, color) for key, value in data.items()}
path = os.path.join(out_dir, "{}.json".format(pid))
with open(path, "w") as f:
json.dump(data, f, indent=2)
f.write("\n")
print("wrote", path, "accent", accent, "bg", bg)
data = dict(DOCK_TEMPLATE)
for token, color in ctx.items():
data = {key: value.replace(token, color) for key, value in data.items()}
path = os.path.join(dock_dir, "{}.json".format(pid))
with open(path, "w") as f:
json.dump(data, f, indent=2)
f.write("\n")
print("wrote", path, "accent", accent, "bg", bg)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion yasb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Requires [YASB](https://github.com/amnweb/yasb) (`winget install AmN.yasb`) and
**Remote** (no git needed — installs YASB if missing, then deploys):

```powershell
irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/windows/yasb/install.ps1 | iex
irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/yasb/install.ps1 | iex
```

**Or locally from this folder:**
Expand Down
2 changes: 1 addition & 1 deletion yasb/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
YASB theme pack remotely without git or manual copying.

Remote one-liner (PowerShell 5.1+):
irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/windows/yasb/install.ps1 | iex
irm https://raw.githubusercontent.com/xscriptor-colors/windows/main/yasb/install.ps1 | iex

Or from a saved file:
powershell -ExecutionPolicy Bypass -File install.ps1
Expand Down
2 changes: 1 addition & 1 deletion yasb/splited/berlin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ berlin/
Styles the system (taskbar, start menu, notification center, file explorer,
settings, borders, corners and menus) with the Berlin palette.

→ [View the installation guide](./windhawk/setup.md)
→ [View the installation guide](../../../windhawk/README.md)

## YASB

Expand Down
2 changes: 1 addition & 1 deletion yasb/splited/bogota/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ bogota/
Styles the system (taskbar, start menu, notification center, file explorer,
settings, borders, corners and menus) with the Bogota palette.

→ [View the installation guide](./windhawk/setup.md)
→ [View the installation guide](../../../windhawk/README.md)

## YASB

Expand Down
2 changes: 1 addition & 1 deletion yasb/splited/helsinki/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ helsinki/
Styles the system (taskbar, start menu, notification center, file explorer,
settings, borders, corners and menus) with the Helsinki palette.

→ [View the installation guide](./windhawk/setup.md)
→ [View the installation guide](../../../windhawk/README.md)

## YASB

Expand Down
2 changes: 1 addition & 1 deletion yasb/splited/lahabana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ lahabana/
Styles the system (taskbar, start menu, notification center, file explorer,
settings, borders, corners and menus) with the Lahabana palette.

→ [View the installation guide](./windhawk/setup.md)
→ [View the installation guide](../../../windhawk/README.md)

## YASB

Expand Down
2 changes: 1 addition & 1 deletion yasb/splited/london/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ london/
Styles the system (taskbar, start menu, notification center, file explorer,
settings, borders, corners and menus) with the London palette.

→ [View the installation guide](./windhawk/setup.md)
→ [View the installation guide](../../../windhawk/README.md)

## YASB

Expand Down
2 changes: 1 addition & 1 deletion yasb/splited/madrid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ madrid/
Styles the system (taskbar, start menu, notification center, file explorer,
settings, borders, corners and menus) with the Madrid palette.

→ [View the installation guide](./windhawk/setup.md)
→ [View the installation guide](../../../windhawk/README.md)

## YASB

Expand Down
2 changes: 1 addition & 1 deletion yasb/splited/miami/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ miami/
Styles the system (taskbar, start menu, notification center, file explorer,
settings, borders, corners and menus) with the Miami palette.

→ [View the installation guide](./windhawk/setup.md)
→ [View the installation guide](../../../windhawk/README.md)

## YASB

Expand Down
Loading
Loading