feat: finalize meta-driven build system and GTK4 support

- Completed migration to meta.yaml driven build strategy.
- Added GTK4 template with aggregated light/dark mode support.
- Updated repository map in GEMINI.md.
This commit is contained in:
s0wlz (Matthias Puchstein)
2025-12-31 00:33:58 +01:00
parent 1e86fa7fa1
commit 3ee1cfd609
3 changed files with 90 additions and 14 deletions

View File

@@ -78,5 +78,6 @@ Apex is not about pretty colors; it is about signal clarity.
│ ├── zsh/
│ ├── kitty/
│ ├── gemini/
│ ├── gtk4/
│ └── alacritty/
└── dist/ # Compiled theme files (gitignore this)

View File

@@ -29,6 +29,19 @@ def build():
# Walk through templates
for root, dirs, files in os.walk(TEMPLATES_DIR):
# Check for meta.yaml in the current directory (app directory)
meta_file = os.path.join(root, 'meta.yaml')
strategy = 'individual' # Default strategy
if os.path.exists(meta_file):
try:
with open(meta_file, 'r') as f:
meta = yaml.safe_load(f)
if meta and 'strategy' in meta:
strategy = meta['strategy']
except Exception as e:
print(f"Warning: Failed to load meta.yaml in {root}: {e}")
for file in files:
if not file.endswith('.j2'):
continue
@@ -44,36 +57,30 @@ def build():
if not os.path.exists(app_dist_dir):
os.makedirs(app_dist_dir)
print(f"Processing template: {template_rel_path}")
print(f"Processing template: {template_rel_path} [Strategy: {strategy}]")
# Special case for Zed: Aggregated output (single JSON for all themes)
if app_name == 'zed':
# Strategy: Aggregated (Single output for all schemes)
if strategy == 'aggregated':
context = {'schemes': schemes}
rendered_content = render_template(template_rel_path, context)
# Output file: dist/zed/apex.json (matches base name)
# Output file: Matches template base name (e.g., apex.json or gtk.css)
output_path = os.path.join(app_dist_dir, output_filename_base)
with open(output_path, 'w') as f:
f.write(rendered_content)
print(f" -> {output_path} (Aggregated)")
print(f" -> {output_path}")
# Default behavior: Per-scheme output
# Strategy: Individual (Per-scheme output)
else:
for scheme in schemes:
scheme_slug = scheme['scheme'].lower().replace(' ', '-')
# Rename output file: e.g., apex.conf -> apex-neon.conf
# or apex.lua -> apex-neon.lua
# If filename is generic 'apex', replace with slug.
# If filename is 'apex.lua', result 'apex-neon.lua'
if 'apex' in output_filename_base:
final_filename = output_filename_base.replace('apex', f"apex-{scheme_slug.replace('apex-', '')}")
else:
final_filename = f"{scheme_slug}-{output_filename_base}"
# Clean up double prefixes if any (e.g. apex-apex-neon)
final_filename = final_filename.replace('apex-apex-', 'apex-')
output_path = os.path.join(app_dist_dir, final_filename)
@@ -85,5 +92,4 @@ def build():
print(f" -> {output_path} ({scheme['scheme']})")
if __name__ == '__main__':
build()
build()

69
templates/gtk4/gtk.css.j2 Normal file
View File

@@ -0,0 +1,69 @@
/* Apex Theme System — GTK4 / Libadwaita */
/* Auto-generated from Apex DNA */
{% for s in schemes %}
/* Scheme: {{ s.scheme }} ({{ s.type }}) */
{% if s.type == 'dark' %}
@media (prefers-color-scheme: dark) {
{% else %}
@media (prefers-color-scheme: light) {
{% endif %}
:root {
/* Core Surfaces */
@define-color window_bg_color {{ s.palette.background }};
@define-color window_fg_color {{ s.palette.foreground }};
@define-color view_bg_color {{ s.palette.background }};
@define-color view_fg_color {{ s.palette.foreground }};
@define-color headerbar_bg_color {{ s.ui.panel }};
@define-color headerbar_fg_color {{ s.palette.foreground }};
@define-color headerbar_border_color {{ s.ui.border }};
@define-color headerbar_backdrop_color @window_bg_color;
@define-color headerbar_shade_color rgba(0, 0, 0, 0.07);
@define-color popover_bg_color {{ s.ui.panel }};
@define-color popover_fg_color {{ s.palette.foreground }};
@define-color card_bg_color {{ s.ui.panel }};
@define-color card_fg_color {{ s.palette.foreground }};
@define-color card_shade_color rgba(0, 0, 0, 0.07);
@define-color dialog_bg_color {{ s.ui.panel }};
@define-color dialog_fg_color {{ s.palette.foreground }};
/* Accents */
@define-color accent_color {{ s.palette.info }};
@define-color accent_bg_color {{ s.palette.info }};
@define-color accent_fg_color {{ s.palette.background }};
@define-color destructive_color {{ s.palette.cursor }};
@define-color destructive_bg_color {{ s.palette.cursor }};
@define-color destructive_fg_color {{ s.palette.background }};
@define-color success_color {{ s.palette.success }};
@define-color success_bg_color {{ s.palette.success }};
@define-color success_fg_color {{ s.palette.background }};
@define-color warning_color {{ s.palette.warning }};
@define-color warning_bg_color {{ s.palette.warning }};
@define-color warning_fg_color {{ s.palette.background }};
@define-color error_color {{ s.ansi.bright.red }};
@define-color error_bg_color {{ s.ansi.bright.red }};
@define-color error_fg_color {{ s.palette.background }};
/* UI Elements */
@define-color borders {{ s.ui.border }};
@define-color sidebar_bg_color {{ s.ui.panel }};
@define-color sidebar_fg_color {{ s.palette.foreground }};
@define-color sidebar_backdrop_color @window_bg_color;
@define-color sidebar_shade_color rgba(0, 0, 0, 0.07);
/* Custom Apex Palette */
@define-color apex_razor {{ s.palette.cursor }};
@define-color apex_void {{ s.palette.background }};
@define-color apex_stealth {{ s.ui.stealth }};
}
}
{% endfor %}