Repository Public
1#!/usr/bin/env python32# =============================================================================3# SP BOUCHER | SOFTWARE & RESEARCH4# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# PROJECT METADATA8# -----------------------------------------------------------------------------9# Project : KA Maps Engine10# File : themes/tools/tables.py11# Description : Écrit `docs/themes/palettes.md` : les palettes effectives12# des sept thèmes, lues dans les JSON livrés.13# Module : themes14# Repository : https://git.spboucher.ai/ka-maps-engine15# Created : 2026-12-0116# Last Modified : 2026-12-0117#18# =============================================================================19# AUTHOR & PROFESSIONAL AFFILIATION20# =============================================================================21#22# Author : Simon-Pierre Boucher23# Position : Professor of Finance24# Institution : Université du Québec en Outaouais (UQO)25# Department : Département des sciences administratives26# Organization : SP Boucher27#28# Website : https://spboucher.ai29# Git : https://git.spboucher.ai30#31# =============================================================================32# OFFICIAL CONTACT DIRECTORY33# =============================================================================34#35# General : info@spboucher.ai36# Professional : contact@spboucher.ai37# Direct : simon@spboucher.ai38# Research : research@spboucher.ai39# Development : dev@spboucher.ai40# Support : support@spboucher.ai41# Security/Admin : admin@spboucher.ai42# Notifications : notifications@spboucher.ai43#44# Preferred Contact: support@spboucher.ai45#46# =============================================================================47# COPYRIGHT & INTELLECTUAL PROPERTY48# =============================================================================49#50# Copyright (c) 202651# Simon-Pierre Boucher52#53# All rights reserved where applicable.54#55# This file is governed by the applicable project license,56# copyright notices, institutional agreements and relevant law.57#58# Unless expressly authorized by the applicable license or59# rights holder, copying, redistribution, sublicensing,60# publication and commercial exploitation are not permitted.61#62# Existing third-party rights and notices remain unaffected.63#64# =============================================================================65# CONFIDENTIALITY & SECURITY66# =============================================================================67#68# Classification : Public69# Distribution : Public repository; use is governed by the project license70# Security Contact : admin@spboucher.ai71#72# Access to this source does not independently grant permission73# to redistribute or disclose confidential materials.74#75# Do not embed credentials, private keys, access tokens,76# certificates or confidential personal information.77#78# =============================================================================79# LICENSE & MAINTENANCE80# =============================================================================81#82# License : None specified (no license file in this repository)83# Maintainer : Simon-Pierre Boucher84# Technical Contact: dev@spboucher.ai85#86# =============================================================================87# END OF SP BOUCHER SOURCE HEADER88# =============================================================================8990"""Écrit `docs/themes/palettes.md` : les palettes effectives des sept thèmes, lues dans les JSON livrés."""91import json92import os9394from check import ROOT, THEMES, resolve9596GROUPS = [97 ("Fonds et lettrage", ["land", "paper", "ink", "ink-soft", "ink-faint", "water-ink", "park-ink"]),98 ("Eau et nature", ["water", "waterway", "water-line", "forest", "grass", "farmland", "wetland", "rock", "sand", "park", "cemetery"]),99 ("Usage du sol", ["residential", "commercial", "industrial", "school", "hospital", "airport", "parking"]),100 ("Voirie", ["road", "road-major", "road-motorway", "road-service", "road-far", "road-far-major", "casing", "casing-major", "casing-motorway", "casing-bridge", "path", "cycleway", "track", "rail", "transit", "transit-ink"]),101 ("Limites et bâti", ["boundary", "boundary-minor", "parcel", "building", "building-outline", "roof", "wall", "building-estimated", "building-outline-estimated", "roof-estimated", "wall-estimated"]),102 ("Lieux", ["poi-education", "poi-health", "poi-commerce", "poi-major", "shield", "shield-ink", "shield-major", "shield-major-ink"]),103 ("Marqueurs", ["accent", "accent-good", "accent-high", "accent-seen", "accent-sold", "accent-selected", "pill-paper", "pill-line"]),104 ("Rampes", ["heat-0", "heat-1", "heat-2", "heat-3", "heat-4", "cool-0", "cool-1", "cool-2", "cool-3", "cool-4", "cool-div-2", "cool-div-1", "neutral", "heat-div-1", "heat-div-2", "null"]),105]106107108def hexa(c):109 h = "#%02x%02x%02x" % tuple(round(x * 255) for x in c[:3])110 return h if c[3] > 0.995 else h + "%02x" % round(c[3] * 255)111112113def main():114 pals = {t: json.load(open(os.path.join(ROOT, f"{t}.json")))["palette"] for t in THEMES}115 md = ["# Palettes effectives des sept thèmes", "", "Produit par `themes/tools/tables.py` depuis `themes/*.json` ; ne pas modifier à la main.", ""]116 for title, keys in GROUPS:117 md += [f"## {title}", "", "| Entrée | " + " | ".join(THEMES) + " |", "|---|" + "---|" * len(THEMES)]118 for k in keys:119 md.append(f"| `{k}` | " + " | ".join(f"`{hexa(resolve('@' + k, pals[t]))}`" for t in THEMES) + " |")120 md.append("")121 out = os.path.join(os.path.dirname(ROOT), "docs", "themes", "palettes.md")122 open(out, "w").write("\n".join(md))123 print(out)124125126if __name__ == "__main__":127 main()128