From 2d9a1e64f9207f4abe1fc0bdd1832cd02b60cb15 Mon Sep 17 00:00:00 2001 From: Gato Date: Fri, 19 Jun 2026 15:49:26 +0200 Subject: [PATCH] fix: inclure le CSS syntect statiquement dans style.css MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit L'injection dynamique via invoke() échouait silencieusement. Le CSS base16-ocean.dark est maintenant scopé (.syntax-highlighting .keyword etc.) et inclus directement dans style.css — aucun appel runtime requis. Co-Authored-By: Claude Sonnet 4.6 --- src/main.js | 11 ----------- src/style.css | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/main.js b/src/main.js index dfe7dab..f6182ac 100644 --- a/src/main.js +++ b/src/main.js @@ -1,18 +1,8 @@ import { showHome, openPath } from './router.js'; import { initCssModal } from './ui/css-modal.js'; -const { invoke } = window.__TAURI__.core; const win = window.__TAURI__.window.getCurrentWindow(); -async function injectSyntaxCss() { - const css = await invoke('get_syntax_highlight_css'); - if (!css) return; - const style = document.createElement('style'); - style.id = 'pena-syntax-style'; - style.textContent = css; - document.head.appendChild(style); -} - document.getElementById('titlebar').addEventListener('mousedown', (e) => { if (e.target.closest('.titlebar-controls')) return; if (e.buttons === 1) win.startDragging(); @@ -42,6 +32,5 @@ document.getElementById('btn-open-dir').addEventListener('click', async () => { document.getElementById('btn-back').addEventListener('click', showHome); -await injectSyntaxCss(); await initCssModal(); showHome(); diff --git a/src/style.css b/src/style.css index eebc424..f9ac03b 100644 --- a/src/style.css +++ b/src/style.css @@ -455,6 +455,43 @@ body { .content pre:not(.syntax-highlighting) { background: #f4f4f7; } .content pre code { background: none; padding: 0; font-weight: 400; font-size: 13px; border: none; border-radius: 0; color: inherit; } +/* ── Coloration syntaxique (base16-ocean.dark) ── */ +.syntax-highlighting { + color: #c0c5ce; + background-color: #2b303b; +} +.syntax-highlighting .variable.parameter.function { color: #c0c5ce; } +.syntax-highlighting .comment, .syntax-highlighting .punctuation.definition.comment { color: #65737e; } +.syntax-highlighting .punctuation.definition.string, .syntax-highlighting .punctuation.definition.variable, .syntax-highlighting .punctuation.definition.parameters, .syntax-highlighting .punctuation.definition.array { color: #c0c5ce; } +.syntax-highlighting .keyword.operator { color: #c0c5ce; } +.syntax-highlighting .keyword { color: #b48ead; } +.syntax-highlighting .variable, .syntax-highlighting .variable.other.dollar.only.js { color: #bf616a; } +.syntax-highlighting .entity.name.function, .syntax-highlighting .meta.require, .syntax-highlighting .support.function.any-method, .syntax-highlighting .variable.function { color: #8fa1b3; } +.syntax-highlighting .support.class, .syntax-highlighting .entity.name.class, .syntax-highlighting .entity.name.type.class { color: #ebcb8b; } +.syntax-highlighting .meta.class { color: #eff1f5; } +.syntax-highlighting .keyword.other.special-method { color: #8fa1b3; } +.syntax-highlighting .storage { color: #b48ead; } +.syntax-highlighting .support.function { color: #96b5b4; } +.syntax-highlighting .string, .syntax-highlighting .constant.other.symbol, .syntax-highlighting .entity.other.inherited-class { color: #a3be8c; } +.syntax-highlighting .constant.numeric, .syntax-highlighting .constant { color: #d08770; } +.syntax-highlighting .entity.name.tag { color: #bf616a; } +.syntax-highlighting .entity.other.attribute-name { color: #d08770; } +.syntax-highlighting .entity.other.attribute-name.id, .syntax-highlighting .punctuation.definition.entity { color: #8fa1b3; } +.syntax-highlighting .meta.selector { color: #b48ead; } +.syntax-highlighting .markup.heading .punctuation.definition.heading, .syntax-highlighting .entity.name.section { color: #8fa1b3; } +.syntax-highlighting .keyword.other.unit { color: #d08770; } +.syntax-highlighting .markup.bold, .syntax-highlighting .punctuation.definition.bold { color: #ebcb8b; font-weight: bold; } +.syntax-highlighting .markup.italic, .syntax-highlighting .punctuation.definition.italic { color: #b48ead; font-style: italic; } +.syntax-highlighting .markup.raw.inline { color: #a3be8c; } +.syntax-highlighting .string.other.link { color: #bf616a; } +.syntax-highlighting .meta.separator { color: #c0c5ce; background-color: #4f5b66; } +.syntax-highlighting .markup.inserted, .syntax-highlighting .markup.inserted.git_gutter { color: #a3be8c; } +.syntax-highlighting .markup.deleted, .syntax-highlighting .markup.deleted.git_gutter { color: #bf616a; } +.syntax-highlighting .markup.changed, .syntax-highlighting .markup.changed.git_gutter { color: #b48ead; } +.syntax-highlighting .constant.other.color, .syntax-highlighting .string.regexp, .syntax-highlighting .constant.character.escape { color: #96b5b4; } +.syntax-highlighting .punctuation.section.embedded, .syntax-highlighting .variable.interpolation { color: #ab7967; } +.syntax-highlighting .invalid.illegal { color: #2b303b; background-color: #bf616a; } + .content blockquote { border-left: 3px solid rgba(34,34,34,0.25); margin: 24px 0;