XXXXXX-XXXXXX-XXXXXX f\xFCr jede RGB-Farbe.",
+ community: {
+ heading: "Community-Paletten",
+ description: "Hier findest du Paletten aus der GitHub-Diskussion. Klicke auf eine Karte, um sie sofort zu \xFCbernehmen oder {{communityLinkStart}}teile deine eigene{{communityLinkEnd}}.",
+ loading: "Paletten werden geladen\u2026",
+ error: "Paletten konnten nicht geladen werden. \xD6ffne die Diskussion, um sie manuell anzusehen.",
+ empty: "Noch keine Community-Paletten vorhanden. Sei der Erste, der eine teilt!",
+ applyHint: "Klicke, um diese Palette anzuwenden"
+ }
+ }
+ },
+ accessibility: {
+ heading: "\u{1F9BE} Barrierefreiheit",
+ description: "Barrierefreiheitsoptionen anzeigen",
+ highTextContrast: {
+ name: "Hoher Textkontrast",
+ description: "Nur wei\xDFe und schwarze Textfarben verwenden"
+ }
+ },
+ experimental: {
+ heading: "\u{1F9EA} Experimentell",
+ description: "Gef\xE4hrliche Aktionen oder extrem instabile Optionen, die jederzeit ge\xE4ndert oder entfernt werden k\xF6nnen",
+ mixColors: {
+ name: "Farben mischen",
+ description: "Hilft dabei, den Text lesbar zu machen"
+ },
+ gradientTransition: {
+ name: "Gradienten\xFCbergang"
+ },
+ tagColors: {
+ name: "Farbzuweisungen",
+ description: "W\xE4hle eine Farbe aus der aktuellen Palette. Beim Wechsel der Palette passt sich der Tag automatisch an.",
+ placeholder: "Tag eingeben",
+ clear: "Farbe zur\xFCcksetzen",
+ empty: "Noch keine Farbzuweisungen",
+ applyHint: "Farbe anwenden"
+ },
+ reset: {
+ name: "Konfiguration zur\xFCcksetzen",
+ description: "\u{1F6A8} Alle Farben aller Tags werden neu berechnet, als w\xE4re es der erste Start des Plugins. Erfordert einen Neustart von Obsidian.",
+ button: "Zur\xFCcksetzen"
+ }
+ }
+ },
+ notices: {
+ updateAvailable: "\u2B06\uFE0F {{pluginName}}: Eine neue Version ist verf\xFCgbar",
+ resetDone: "\u2705 Zur\xFCcksetzen abgeschlossen\nBitte Obsidian neu starten",
+ communityPaletteApplied: "\u{1F3A8} Community-Palette von {{author}} erfolgreich angewendet"
+ }
+};
+
+// src/i18n/en.json
+var en_default = {
+ settings: {
+ palette: {
+ heading: "Palette",
+ description: "Select palette",
+ options: {
+ adaptiveSoft: "\u{1F338} Adaptive soft",
+ adaptiveBright: "\u{1F33A} Adaptive bright",
+ custom: "Custom"
+ },
+ shift: {
+ name: "Palette shift",
+ description: "If the colors of some tags don't fit, you can shift the palette."
+ },
+ custom: {
+ name: "Custom palette",
+ placeholder: "Paste palette",
+ description: "The format is XXXXXX-XXXXXX-XXXXXX for each RGB color.",
+ community: {
+ heading: "Community palettes",
+ description: "Below are palettes collected from the GitHub discussion. Click any card to apply it instantly or {{communityLinkStart}}share your own{{communityLinkEnd}}.",
+ loading: "Loading palettes\u2026",
+ error: "Unable to load palettes right now. Feel free to open the discussion to browse them manually.",
+ empty: "No shared palettes yet. Be the first to post one!",
+ applyHint: "Click to apply this palette"
+ }
+ }
+ },
+ accessibility: {
+ heading: "\u{1F9BE} Accessibility",
+ description: "Show accessibility options",
+ highTextContrast: {
+ name: "High text contrast",
+ description: "Use only white and black colors for texts"
+ }
+ },
+ experimental: {
+ heading: "\u{1F9EA} Experimental",
+ description: "Dangerous actions or insanely unstable options that could be changed or removed in any time",
+ mixColors: {
+ name: "Mix colors",
+ description: "It helps to make text readable"
+ },
+ gradientTransition: {
+ name: "Gradient transition"
+ },
+ tagColors: {
+ name: "Tag assignments",
+ description: "Choose a color from the current palette. If you change the palette, the tag adapts to the nearest color.",
+ placeholder: "Start typing a tag",
+ clear: "Reset color",
+ empty: "No tag overrides yet",
+ applyHint: "Apply color"
+ },
+ reset: {
+ name: "Reset config",
+ description: "\u{1F6A8} All colors of all tags will be recalculated as if it was the first launch of the plugin. Requires restart of Obsidian.",
+ button: "Reset"
+ }
+ }
+ },
+ notices: {
+ updateAvailable: "\u2B06\uFE0F {{pluginName}}: a new version is available",
+ resetDone: "\u2705 Reset is done\nPlease restart Obsidian",
+ communityPaletteApplied: "\u{1F3A8} Applied community palette by {{author}}"
+ }
+};
+
+// src/i18n/es.json
+var es_default = {
+ settings: {
+ palette: {
+ heading: "Paleta",
+ description: "Seleccionar paleta",
+ options: {
+ adaptiveSoft: "\u{1F338} Suave adaptable",
+ adaptiveBright: "\u{1F33A} Brillante adaptable",
+ custom: "Personalizada"
+ },
+ shift: {
+ name: "Desplazamiento de paleta",
+ description: "Si los colores de algunas etiquetas no encajan, puedes desplazar la paleta."
+ },
+ custom: {
+ name: "Paleta personalizada",
+ placeholder: "Pegar paleta",
+ description: "El formato es XXXXXX-XXXXXX-XXXXXX para cada color RGB.",
+ community: {
+ heading: "Paletas de la comunidad",
+ description: "A continuaci\xF3n hay paletas recopiladas de la discusi\xF3n en GitHub. Haz clic en cualquier tarjeta para aplicarla al instante o {{communityLinkStart}}comparte la tuya{{communityLinkEnd}}.",
+ loading: "Cargando paletas\u2026",
+ error: "No se pueden cargar las paletas en este momento. Si\xE9ntete libre de abrir la discusi\xF3n para explorarlas manualmente.",
+ empty: "A\xFAn no hay paletas compartidas. \xA1S\xE9 el primero en publicar una!",
+ applyHint: "Haz clic para aplicar esta paleta"
+ }
+ }
+ },
+ accessibility: {
+ heading: "\u{1F9BE} Accesibilidad",
+ description: "Mostrar opciones de accesibilidad",
+ highTextContrast: {
+ name: "Alto contraste de texto",
+ description: "Usar solo colores blanco y negro para los textos"
+ }
+ },
+ experimental: {
+ heading: "\u{1F9EA} Experimental",
+ description: "Acciones peligrosas u opciones inestables que podr\xEDan cambiarse o eliminarse en cualquier momento",
+ mixColors: {
+ name: "Mezclar colores",
+ description: "Ayuda a hacer el texto legible"
+ },
+ gradientTransition: {
+ name: "Transici\xF3n de degradado"
+ },
+ tagColors: {
+ name: "Asignaciones de etiquetas",
+ description: "Elige un color de la paleta actual. Si cambias la paleta, la etiqueta se adapta al color m\xE1s cercano.",
+ placeholder: "Empieza a escribir una etiqueta",
+ clear: "Restablecer color",
+ empty: "A\xFAn no hay anulaciones de etiquetas",
+ applyHint: "Aplicar color"
+ },
+ reset: {
+ name: "Restablecer configuraci\xF3n",
+ description: "\u{1F6A8} Todos los colores de todas las etiquetas se recalcular\xE1n como si fuera el primer lanzamiento del plugin. Requiere reiniciar Obsidian.",
+ button: "Restablecer"
+ }
+ }
+ },
+ notices: {
+ updateAvailable: "\u2B06\uFE0F {{pluginName}}: hay una nueva versi\xF3n disponible",
+ resetDone: "\u2705 Restablecimiento completado\nPor favor, reinicia Obsidian",
+ communityPaletteApplied: "\u{1F3A8} Paleta de la comunidad aplicada por {{author}}"
+ }
+};
+
+// src/i18n/fr.json
+var fr_default = {
+ settings: {
+ palette: {
+ heading: "Palette",
+ description: "S\xE9lectionner une palette",
+ options: {
+ adaptiveSoft: "\u{1F338} Doux adaptatif",
+ adaptiveBright: "\u{1F33A} Vif adaptatif",
+ custom: "Personnalis\xE9e"
+ },
+ shift: {
+ name: "D\xE9calage de palette",
+ description: "Si les couleurs de certaines \xE9tiquettes ne conviennent pas, vous pouvez d\xE9caler la palette."
+ },
+ custom: {
+ name: "Palette personnalis\xE9e",
+ placeholder: "Coller une palette",
+ description: "Le format est XXXXXX-XXXXXX-XXXXXX pour chaque couleur RVB.",
+ community: {
+ heading: "Palettes communautaires",
+ description: "Ci-dessous se trouvent des palettes collect\xE9es depuis la discussion GitHub. Cliquez sur une carte pour l'appliquer instantan\xE9ment ou {{communityLinkStart}}partagez la v\xF4tre{{communityLinkEnd}}.",
+ loading: "Chargement des palettes\u2026",
+ error: "Impossible de charger les palettes pour le moment. N'h\xE9sitez pas \xE0 ouvrir la discussion pour les parcourir manuellement.",
+ empty: "Aucune palette partag\xE9e pour l'instant. Soyez le premier \xE0 en publier une !",
+ applyHint: "Cliquez pour appliquer cette palette"
+ }
+ }
+ },
+ accessibility: {
+ heading: "\u{1F9BE} Accessibilit\xE9",
+ description: "Afficher les options d'accessibilit\xE9",
+ highTextContrast: {
+ name: "Contraste de texte \xE9lev\xE9",
+ description: "Utiliser uniquement le blanc et le noir pour les textes"
+ }
+ },
+ experimental: {
+ heading: "\u{1F9EA} Exp\xE9rimental",
+ description: "Actions dangereuses ou options instables qui pourraient \xEAtre modifi\xE9es ou supprim\xE9es \xE0 tout moment",
+ mixColors: {
+ name: "M\xE9langer les couleurs",
+ description: "Cela aide \xE0 rendre le texte lisible"
+ },
+ gradientTransition: {
+ name: "Transition de d\xE9grad\xE9"
+ },
+ tagColors: {
+ name: "Affectations d'\xE9tiquettes",
+ description: "Choisissez une couleur de la palette actuelle. Si vous changez la palette, l'\xE9tiquette s'adapte \xE0 la couleur la plus proche.",
+ placeholder: "Commencez \xE0 taper une \xE9tiquette",
+ clear: "R\xE9initialiser la couleur",
+ empty: "Aucune substitution d'\xE9tiquette pour l'instant",
+ applyHint: "Appliquer la couleur"
+ },
+ reset: {
+ name: "R\xE9initialiser la config",
+ description: "\u{1F6A8} Toutes les couleurs de toutes les \xE9tiquettes seront recalcul\xE9es comme lors du premier lancement du plugin. N\xE9cessite le red\xE9marrage d'Obsidian.",
+ button: "R\xE9initialiser"
+ }
+ }
+ },
+ notices: {
+ updateAvailable: "\u2B06\uFE0F {{pluginName}} : une nouvelle version est disponible",
+ resetDone: "\u2705 R\xE9initialisation termin\xE9e\nVeuillez red\xE9marrer Obsidian",
+ communityPaletteApplied: "\u{1F3A8} Palette communautaire appliqu\xE9e par {{author}}"
+ }
+};
+
+// src/i18n/it.json
+var it_default = {
+ settings: {
+ palette: {
+ heading: "Tavolozza",
+ description: "Seleziona tavolozza",
+ options: {
+ adaptiveSoft: "\u{1F338} Adattiva tenue",
+ adaptiveBright: "\u{1F33A} Adattiva vivace",
+ custom: "Personalizzata"
+ },
+ shift: {
+ name: "Spostamento tavolozza",
+ description: "Se i colori di alcune etichette non vanno bene, puoi spostare la tavolozza."
+ },
+ custom: {
+ name: "Tavolozza personalizzata",
+ placeholder: "Incolla tavolozza",
+ description: "Il formato \xE8 XXXXXX-XXXXXX-XXXXXX per ogni colore RGB.",
+ community: {
+ heading: "Tavolozze della comunit\xE0",
+ description: "Di seguito sono riportate le tavolozze raccolte dalla discussione su GitHub. Clicca su qualsiasi scheda per applicarla istantaneamente o {{communityLinkStart}}condividi la tua{{communityLinkEnd}}.",
+ loading: "Caricamento tavolozze\u2026",
+ error: "Impossibile caricare le tavolozze al momento. Sentiti libero di aprire la discussione per sfogliarle manualmente.",
+ empty: "Nessuna tavolozza condivisa ancora. Sii il primo a pubblicarne una!",
+ applyHint: "Clicca per applicare questa tavolozza"
+ }
+ }
+ },
+ accessibility: {
+ heading: "\u{1F9BE} Accessibilit\xE0",
+ description: "Mostra opzioni di accessibilit\xE0",
+ highTextContrast: {
+ name: "Alto contrasto del testo",
+ description: "Usa solo bianco e nero per i testi"
+ }
+ },
+ experimental: {
+ heading: "\u{1F9EA} Sperimentale",
+ description: "Azioni pericolose o opzioni instabili che potrebbero essere modificate o rimosse in qualsiasi momento",
+ mixColors: {
+ name: "Mescola colori",
+ description: "Aiuta a rendere leggibile il testo"
+ },
+ gradientTransition: {
+ name: "Transizione gradiente"
+ },
+ tagColors: {
+ name: "Assegnazioni etichette",
+ description: "Scegli un colore dalla tavolozza corrente. Se cambi la tavolozza, l'etichetta si adatta al colore pi\xF9 vicino.",
+ placeholder: "Inizia a digitare un'etichetta",
+ clear: "Reimposta colore",
+ empty: "Nessuna sovrascrittura etichetta ancora",
+ applyHint: "Applica colore"
+ },
+ reset: {
+ name: "Reimposta configurazione",
+ description: "\u{1F6A8} Tutti i colori di tutte le etichette verranno ricalcolati come se fosse il primo avvio del plugin. Richiede il riavvio di Obsidian.",
+ button: "Reimposta"
+ }
+ }
+ },
+ notices: {
+ updateAvailable: "\u2B06\uFE0F {{pluginName}}: \xE8 disponibile una nuova versione",
+ resetDone: "\u2705 Reimpostazione completata\nSi prega di riavviare Obsidian",
+ communityPaletteApplied: "\u{1F3A8} Tavolozza della comunit\xE0 applicata da {{author}}"
+ }
+};
+
+// src/i18n/ja.json
+var ja_default = {
+ settings: {
+ palette: {
+ heading: "\u30D1\u30EC\u30C3\u30C8",
+ description: "\u30D1\u30EC\u30C3\u30C8\u3092\u9078\u629E",
+ options: {
+ adaptiveSoft: "\u{1F338} \u30A2\u30C0\u30D7\u30C6\u30A3\u30D6\u30BD\u30D5\u30C8",
+ adaptiveBright: "\u{1F33A} \u30A2\u30C0\u30D7\u30C6\u30A3\u30D6\u30D6\u30E9\u30A4\u30C8",
+ custom: "\u30AB\u30B9\u30BF\u30E0"
+ },
+ shift: {
+ name: "\u30D1\u30EC\u30C3\u30C8\u30B7\u30D5\u30C8",
+ description: "\u4E00\u90E8\u306E\u30BF\u30B0\u306E\u8272\u304C\u5408\u308F\u306A\u3044\u5834\u5408\u306F\u3001\u30D1\u30EC\u30C3\u30C8\u3092\u30B7\u30D5\u30C8\u3067\u304D\u307E\u3059\u3002"
+ },
+ custom: {
+ name: "\u30AB\u30B9\u30BF\u30E0\u30D1\u30EC\u30C3\u30C8",
+ placeholder: "\u30D1\u30EC\u30C3\u30C8\u3092\u8CBC\u308A\u4ED8\u3051",
+ description: "\u5F62\u5F0F\u306F\u5404RGB\u30AB\u30E9\u30FC\u306B\u3064\u304D XXXXXX-XXXXXX-XXXXXX \u3067\u3059\u3002",
+ community: {
+ heading: "\u30B3\u30DF\u30E5\u30CB\u30C6\u30A3\u30D1\u30EC\u30C3\u30C8",
+ description: "\u4EE5\u4E0B\u306FGitHub\u306E\u30C7\u30A3\u30B9\u30AB\u30C3\u30B7\u30E7\u30F3\u304B\u3089\u53CE\u96C6\u3055\u308C\u305F\u30D1\u30EC\u30C3\u30C8\u3067\u3059\u3002\u30AB\u30FC\u30C9\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u5373\u5EA7\u306B\u9069\u7528\u3059\u308B\u304B\u3001{{communityLinkStart}}\u81EA\u5206\u306E\u3082\u306E\u3092\u5171\u6709{{communityLinkEnd}}\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
+ loading: "\u30D1\u30EC\u30C3\u30C8\u3092\u8AAD\u307F\u8FBC\u307F\u4E2D\u2026",
+ error: "\u73FE\u5728\u30D1\u30EC\u30C3\u30C8\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093\u3002\u30C7\u30A3\u30B9\u30AB\u30C3\u30B7\u30E7\u30F3\u3092\u958B\u3044\u3066\u624B\u52D5\u3067\u95B2\u89A7\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
+ empty: "\u5171\u6709\u3055\u308C\u305F\u30D1\u30EC\u30C3\u30C8\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093\u3002\u6700\u521D\u306B\u6295\u7A3F\u3057\u307E\u3057\u3087\u3046\uFF01",
+ applyHint: "\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u3053\u306E\u30D1\u30EC\u30C3\u30C8\u3092\u9069\u7528"
+ }
+ }
+ },
+ accessibility: {
+ heading: "\u{1F9BE} \u30A2\u30AF\u30BB\u30B7\u30D3\u30EA\u30C6\u30A3",
+ description: "\u30A2\u30AF\u30BB\u30B7\u30D3\u30EA\u30C6\u30A3\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\u8868\u793A",
+ highTextContrast: {
+ name: "\u9AD8\u30C6\u30AD\u30B9\u30C8\u30B3\u30F3\u30C8\u30E9\u30B9\u30C8",
+ description: "\u30C6\u30AD\u30B9\u30C8\u306B\u767D\u3068\u9ED2\u306E\u8272\u306E\u307F\u3092\u4F7F\u7528"
+ }
+ },
+ experimental: {
+ heading: "\u{1F9EA} \u5B9F\u9A13\u7684",
+ description: "\u3044\u3064\u3067\u3082\u5909\u66F4\u307E\u305F\u306F\u524A\u9664\u3055\u308C\u308B\u53EF\u80FD\u6027\u306E\u3042\u308B\u5371\u967A\u306A\u30A2\u30AF\u30B7\u30E7\u30F3\u307E\u305F\u306F\u4E0D\u5B89\u5B9A\u306A\u30AA\u30D7\u30B7\u30E7\u30F3",
+ mixColors: {
+ name: "\u8272\u3092\u6DF7\u305C\u308B",
+ description: "\u30C6\u30AD\u30B9\u30C8\u3092\u8AAD\u307F\u3084\u3059\u304F\u3059\u308B\u306E\u306B\u5F79\u7ACB\u3061\u307E\u3059"
+ },
+ gradientTransition: {
+ name: "\u30B0\u30E9\u30C7\u30FC\u30B7\u30E7\u30F3\u9077\u79FB"
+ },
+ tagColors: {
+ name: "\u30BF\u30B0\u306E\u5272\u308A\u5F53\u3066",
+ description: "\u73FE\u5728\u306E\u30D1\u30EC\u30C3\u30C8\u304B\u3089\u8272\u3092\u9078\u629E\u3057\u307E\u3059\u3002\u30D1\u30EC\u30C3\u30C8\u3092\u5909\u66F4\u3059\u308B\u3068\u3001\u30BF\u30B0\u306F\u6700\u3082\u8FD1\u3044\u8272\u306B\u9069\u5FDC\u3057\u307E\u3059\u3002",
+ placeholder: "\u30BF\u30B0\u306E\u5165\u529B\u3092\u958B\u59CB",
+ clear: "\u8272\u3092\u30EA\u30BB\u30C3\u30C8",
+ empty: "\u30BF\u30B0\u306E\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u306F\u307E\u3060\u3042\u308A\u307E\u305B\u3093",
+ applyHint: "\u8272\u3092\u9069\u7528"
+ },
+ reset: {
+ name: "\u8A2D\u5B9A\u3092\u30EA\u30BB\u30C3\u30C8",
+ description: "\u{1F6A8} \u3059\u3079\u3066\u306E\u30BF\u30B0\u306E\u3059\u3079\u3066\u306E\u8272\u304C\u3001\u30D7\u30E9\u30B0\u30A4\u30F3\u306E\u521D\u56DE\u8D77\u52D5\u6642\u306E\u3088\u3046\u306B\u518D\u8A08\u7B97\u3055\u308C\u307E\u3059\u3002Obsidian\u306E\u518D\u8D77\u52D5\u304C\u5FC5\u8981\u3067\u3059\u3002",
+ button: "\u30EA\u30BB\u30C3\u30C8"
+ }
+ }
+ },
+ notices: {
+ updateAvailable: "\u2B06\uFE0F {{pluginName}}: \u65B0\u3057\u3044\u30D0\u30FC\u30B8\u30E7\u30F3\u304C\u5229\u7528\u53EF\u80FD\u3067\u3059",
+ resetDone: "\u2705 \u30EA\u30BB\u30C3\u30C8\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F\nObsidian\u3092\u518D\u8D77\u52D5\u3057\u3066\u304F\u3060\u3055\u3044",
+ communityPaletteApplied: "\u{1F3A8} {{author}} \u306B\u3088\u308B\u30B3\u30DF\u30E5\u30CB\u30C6\u30A3\u30D1\u30EC\u30C3\u30C8\u304C\u9069\u7528\u3055\u308C\u307E\u3057\u305F"
+ }
+};
+
+// src/i18n/pt.json
+var pt_default = {
+ settings: {
+ palette: {
+ heading: "Paleta",
+ description: "Selecionar paleta",
+ options: {
+ adaptiveSoft: "\u{1F338} Suave adapt\xE1vel",
+ adaptiveBright: "\u{1F33A} Brilhante adapt\xE1vel",
+ custom: "Personalizada"
+ },
+ shift: {
+ name: "Deslocamento de paleta",
+ description: "Se as cores de algumas etiquetas n\xE3o se ajustarem, voc\xEA pode deslocar a paleta."
+ },
+ custom: {
+ name: "Paleta personalizada",
+ placeholder: "Colar paleta",
+ description: "O formato \xE9 XXXXXX-XXXXXX-XXXXXX para cada cor RGB.",
+ community: {
+ heading: "Paletas da comunidade",
+ description: "Abaixo est\xE3o paletas coletadas da discuss\xE3o no GitHub. Clique em qualquer cart\xE3o para aplic\xE1-la instantaneamente ou {{communityLinkStart}}compartilhe a sua{{communityLinkEnd}}.",
+ loading: "Carregando paletas\u2026",
+ error: "N\xE3o foi poss\xEDvel carregar as paletas agora. Sinta-se \xE0 vontade para abrir a discuss\xE3o para naveg\xE1-las manualmente.",
+ empty: "Nenhuma paleta compartilhada ainda. Seja o primeiro a postar uma!",
+ applyHint: "Clique para aplicar esta paleta"
+ }
+ }
+ },
+ accessibility: {
+ heading: "\u{1F9BE} Acessibilidade",
+ description: "Mostrar op\xE7\xF5es de acessibilidade",
+ highTextContrast: {
+ name: "Alto contraste de texto",
+ description: "Usar apenas cores branca e preta para textos"
+ }
+ },
+ experimental: {
+ heading: "\u{1F9EA} Experimental",
+ description: "A\xE7\xF5es perigosas ou op\xE7\xF5es inst\xE1veis que podem ser alteradas ou removidas a qualquer momento",
+ mixColors: {
+ name: "Misturar cores",
+ description: "Ajuda a tornar o texto leg\xEDvel"
+ },
+ gradientTransition: {
+ name: "Transi\xE7\xE3o de gradiente"
+ },
+ tagColors: {
+ name: "Atribui\xE7\xF5es de etiquetas",
+ description: "Escolha uma cor da paleta atual. Se voc\xEA mudar a paleta, a etiqueta se adapta \xE0 cor mais pr\xF3xima.",
+ placeholder: "Comece a digitar uma etiqueta",
+ clear: "Redefinir cor",
+ empty: "Nenhuma substitui\xE7\xE3o de etiqueta ainda",
+ applyHint: "Aplicar cor"
+ },
+ reset: {
+ name: "Redefinir configura\xE7\xE3o",
+ description: "\u{1F6A8} Todas as cores de todas as etiquetas ser\xE3o recalculadas como se fosse o primeiro lan\xE7amento do plugin. Requer reinicializa\xE7\xE3o do Obsidian.",
+ button: "Redefinir"
+ }
+ }
+ },
+ notices: {
+ updateAvailable: "\u2B06\uFE0F {{pluginName}}: uma nova vers\xE3o est\xE1 dispon\xEDvel",
+ resetDone: "\u2705 Redefini\xE7\xE3o conclu\xEDda\nPor favor, reinicie o Obsidian",
+ communityPaletteApplied: "\u{1F3A8} Paleta da comunidade aplicada por {{author}}"
+ }
+};
+
+// src/i18n/ru.json
+var ru_default = {
+ settings: {
+ palette: {
+ heading: "\u041F\u0430\u043B\u0438\u0442\u0440\u0430",
+ description: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043F\u0430\u043B\u0438\u0442\u0440\u0443",
+ options: {
+ adaptiveSoft: "\u{1F338} \u0410\u0434\u0430\u043F\u0442\u0438\u0432\u043D\u0430\u044F \u043C\u044F\u0433\u043A\u0430\u044F",
+ adaptiveBright: "\u{1F33A} \u0410\u0434\u0430\u043F\u0442\u0438\u0432\u043D\u0430\u044F \u044F\u0440\u043A\u0430\u044F",
+ custom: "\u0421\u0432\u043E\u044F"
+ },
+ shift: {
+ name: "\u0421\u0434\u0432\u0438\u0433 \u043F\u0430\u043B\u0438\u0442\u0440\u044B",
+ description: "\u0415\u0441\u043B\u0438 \u0446\u0432\u0435\u0442\u0430 \u043A\u0430\u043A\u0438\u0445-\u0442\u043E \u0442\u0435\u0433\u043E\u0432 \u043D\u0435 \u043F\u043E\u0434\u0445\u043E\u0434\u044F\u0442, \u043C\u043E\u0436\u043D\u043E \u0441\u0434\u0432\u0438\u043D\u0443\u0442\u044C \u043F\u0430\u043B\u0438\u0442\u0440\u0443."
+ },
+ custom: {
+ name: "\u0421\u0432\u043E\u044F \u043F\u0430\u043B\u0438\u0442\u0440\u0430",
+ placeholder: "\u0412\u0441\u0442\u0430\u0432\u044C\u0442\u0435 \u043F\u0430\u043B\u0438\u0442\u0440\u0443",
+ description: "\u0424\u043E\u0440\u043C\u0430\u0442 XXXXXX-XXXXXX-XXXXXX \u0434\u043B\u044F \u043A\u0430\u0436\u0434\u043E\u0433\u043E RGB-\u0446\u0432\u0435\u0442\u0430.",
+ community: {
+ heading: "\u041F\u0430\u043B\u0438\u0442\u0440\u044B \u0441\u043E\u043E\u0431\u0449\u0435\u0441\u0442\u0432\u0430",
+ description: "\u041D\u0438\u0436\u0435 \u0441\u043E\u0431\u0440\u0430\u043D\u044B \u043F\u0430\u043B\u0438\u0442\u0440\u044B \u0438\u0437 \u043E\u0431\u0441\u0443\u0436\u0434\u0435\u043D\u0438\u044F \u043D\u0430 GitHub. \u041A\u043B\u0438\u043A\u043D\u0438\u0442\u0435 \u043F\u043E \u043A\u0430\u0440\u0442\u043E\u0447\u043A\u0435, \u0447\u0442\u043E\u0431\u044B \u043F\u0440\u0438\u043C\u0435\u043D\u0438\u0442\u044C \u0435\u0451 \u0438\u043B\u0438 {{communityLinkStart}}\u043F\u043E\u0434\u0435\u043B\u0438\u0442\u0435\u0441\u044C \u0441\u0432\u043E\u0435\u0439{{communityLinkEnd}}.",
+ loading: "\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043C \u043F\u0430\u043B\u0438\u0442\u0440\u044B\u2026",
+ error: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C \u043F\u0430\u043B\u0438\u0442\u0440\u044B. \u041E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u043E\u0431\u0441\u0443\u0436\u0434\u0435\u043D\u0438\u0435, \u0447\u0442\u043E\u0431\u044B \u043F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C \u0438\u0445 \u0432\u0440\u0443\u0447\u043D\u0443\u044E.",
+ empty: "\u041F\u043E\u043A\u0430 \u043D\u0438\u043A\u0442\u043E \u043D\u0435 \u043F\u043E\u0434\u0435\u043B\u0438\u043B\u0441\u044F \u043F\u0430\u043B\u0438\u0442\u0440\u0430\u043C\u0438. \u0411\u0443\u0434\u044C\u0442\u0435 \u043F\u0435\u0440\u0432\u044B\u043C\u0438!",
+ applyHint: "\u041D\u0430\u0436\u043C\u0438\u0442\u0435, \u0447\u0442\u043E\u0431\u044B \u043F\u0440\u0438\u043C\u0435\u043D\u0438\u0442\u044C \u044D\u0442\u0443 \u043F\u0430\u043B\u0438\u0442\u0440\u0443"
+ }
+ }
+ },
+ accessibility: {
+ heading: "\u{1F9BE} \u0414\u043E\u0441\u0442\u0443\u043F\u043D\u043E\u0441\u0442\u044C",
+ description: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0438 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u043E\u0441\u0442\u0438",
+ highTextContrast: {
+ name: "\u0412\u044B\u0441\u043E\u043A\u0438\u0439 \u043A\u043E\u043D\u0442\u0440\u0430\u0441\u0442 \u0442\u0435\u043A\u0441\u0442\u0430",
+ description: "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0442\u043E\u043B\u044C\u043A\u043E \u0431\u0435\u043B\u044B\u0439 \u0438 \u0447\u0435\u0440\u043D\u044B\u0439 \u0446\u0432\u0435\u0442\u0430 \u0442\u0435\u043A\u0441\u0442\u0430"
+ }
+ },
+ experimental: {
+ heading: "\u{1F9EA} \u042D\u043A\u0441\u043F\u0435\u0440\u0438\u043C\u0435\u043D\u0442\u0430\u043B\u044C\u043D\u044B\u0435",
+ description: "\u041E\u043F\u0430\u0441\u043D\u044B\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044F \u0438\u043B\u0438 \u043D\u0435\u0441\u0442\u0430\u0431\u0438\u043B\u044C\u043D\u044B\u0435 \u043E\u043F\u0446\u0438\u0438, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u043C\u043E\u0433\u0443\u0442 \u0431\u044B\u0442\u044C \u0438\u0437\u043C\u0435\u043D\u0435\u043D\u044B \u0438\u043B\u0438 \u0443\u0434\u0430\u043B\u0435\u043D\u044B \u0432 \u043B\u044E\u0431\u043E\u0439 \u043C\u043E\u043C\u0435\u043D\u0442",
+ mixColors: {
+ name: "\u0421\u043C\u0435\u0448\u0438\u0432\u0430\u0442\u044C \u0446\u0432\u0435\u0442\u0430",
+ description: "\u041F\u043E\u043C\u043E\u0433\u0430\u0435\u0442 \u0441\u0434\u0435\u043B\u0430\u0442\u044C \u0442\u0435\u043A\u0441\u0442 \u0447\u0438\u0442\u0430\u0435\u043C\u044B\u043C"
+ },
+ gradientTransition: {
+ name: "\u041F\u043B\u0430\u0432\u043D\u044B\u0439 \u0433\u0440\u0430\u0434\u0438\u0435\u043D\u0442"
+ },
+ tagColors: {
+ name: "\u041D\u0430\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0446\u0432\u0435\u0442\u043E\u0432",
+ description: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0446\u0432\u0435\u0442 \u0438\u0437 \u0442\u0435\u043A\u0443\u0449\u0435\u0439 \u043F\u0430\u043B\u0438\u0442\u0440\u044B. \u041F\u0440\u0438 \u0441\u043C\u0435\u043D\u0435 \u043F\u0430\u043B\u0438\u0442\u0440\u044B \u0442\u0435\u0433 \u0430\u0434\u0430\u043F\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044F \u043A \u0431\u043B\u0438\u0436\u0430\u0439\u0448\u0435\u043C\u0443 \u0446\u0432\u0435\u0442\u0443.",
+ placeholder: "\u041D\u0430\u0447\u043D\u0438\u0442\u0435 \u0432\u0432\u043E\u0434\u0438\u0442\u044C \u0442\u0435\u0433",
+ clear: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u0446\u0432\u0435\u0442",
+ empty: "\u041F\u043E\u043A\u0430 \u043D\u0435\u0442 \u043D\u0430\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044B\u0445 \u0446\u0432\u0435\u0442\u043E\u0432",
+ applyHint: "\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0446\u0432\u0435\u0442"
+ },
+ reset: {
+ name: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C \u043A\u043E\u043D\u0444\u0438\u0433",
+ description: "\u{1F6A8} \u0412\u0441\u0435 \u0446\u0432\u0435\u0442\u0430 \u0432\u0441\u0435\u0445 \u0442\u0435\u0433\u043E\u0432 \u0431\u0443\u0434\u0443\u0442 \u043F\u0435\u0440\u0435\u0441\u0447\u0438\u0442\u0430\u043D\u044B \u0442\u0430\u043A, \u0431\u0443\u0434\u0442\u043E \u043F\u043B\u0430\u0433\u0438\u043D \u0437\u0430\u043F\u0443\u0441\u043A\u0430\u0435\u0442\u0441\u044F \u0432\u043F\u0435\u0440\u0432\u044B\u0435. \u0422\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044F \u043F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u043A Obsidian.",
+ button: "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C"
+ }
+ }
+ },
+ notices: {
+ updateAvailable: "\u2B06\uFE0F {{pluginName}}: \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u0430 \u043D\u043E\u0432\u0430\u044F \u0432\u0435\u0440\u0441\u0438\u044F",
+ resetDone: "\u2705 \u0421\u0431\u0440\u043E\u0441 \u0432\u044B\u043F\u043E\u043B\u043D\u0435\u043D\n\u041F\u0435\u0440\u0435\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u0435 Obsidian",
+ communityPaletteApplied: "\u{1F3A8} \u041F\u0430\u043B\u0438\u0442\u0440\u0430 \u0441\u043E\u043E\u0431\u0449\u0435\u0441\u0442\u0432\u0430 \u043E\u0442 {{author}} \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u043F\u0440\u0438\u043C\u0435\u043D\u0435\u043D\u0430"
+ }
+};
+
+// src/i18n/zh.json
+var zh_default = {
+ settings: {
+ palette: {
+ heading: "\u8C03\u8272\u677F",
+ description: "\u9009\u62E9\u8C03\u8272\u677F",
+ options: {
+ adaptiveSoft: "\u{1F338} \u81EA\u9002\u5E94\u67D4\u548C",
+ adaptiveBright: "\u{1F33A} \u81EA\u9002\u5E94\u9C9C\u8273",
+ custom: "\u81EA\u5B9A\u4E49"
+ },
+ shift: {
+ name: "\u8C03\u8272\u677F\u504F\u79FB",
+ description: "\u5982\u679C\u67D0\u4E9B\u6807\u7B7E\u7684\u989C\u8272\u4E0D\u5408\u9002\uFF0C\u53EF\u4EE5\u504F\u79FB\u8C03\u8272\u677F\u3002"
+ },
+ custom: {
+ name: "\u81EA\u5B9A\u4E49\u8C03\u8272\u677F",
+ placeholder: "\u7C98\u8D34\u8C03\u8272\u677F",
+ description: "\u6BCF\u79CD RGB \u989C\u8272\u7684\u683C\u5F0F\u4E3A XXXXXX-XXXXXX-XXXXXX\u3002",
+ community: {
+ heading: "\u793E\u533A\u8C03\u8272\u677F",
+ description: "\u4E0B\u65B9\u5C55\u793A\u6765\u81EA GitHub \u8BA8\u8BBA\u533A\u7684\u8C03\u8272\u677F\u3002\u70B9\u51FB\u4EFB\u610F\u5361\u7247\u5373\u53EF\u7ACB\u5373\u5E94\u7528\uFF0C\u6216{{communityLinkStart}}\u5206\u4EAB\u4F60\u7684\u914D\u8272{{communityLinkEnd}}\u3002",
+ loading: "\u6B63\u5728\u52A0\u8F7D\u8C03\u8272\u677F\u2026",
+ error: "\u6682\u65F6\u65E0\u6CD5\u52A0\u8F7D\u8C03\u8272\u677F\uFF0C\u8BF7\u6253\u5F00\u8BA8\u8BBA\u9875\u9762\u624B\u52A8\u67E5\u770B\u3002",
+ empty: "\u8FD8\u6CA1\u6709\u4EBA\u5206\u4EAB\u8C03\u8272\u677F\uFF0C\u6B22\u8FCE\u7387\u5148\u8D21\u732E\uFF01",
+ applyHint: "\u70B9\u51FB\u5373\u53EF\u5E94\u7528\u6B64\u8C03\u8272\u677F"
+ }
+ }
+ },
+ accessibility: {
+ heading: "\u{1F9BE} \u65E0\u969C\u788D",
+ description: "\u663E\u793A\u65E0\u969C\u788D\u9009\u9879",
+ highTextContrast: {
+ name: "\u9AD8\u5BF9\u6BD4\u6587\u672C",
+ description: "\u4EC5\u5BF9\u6587\u672C\u4F7F\u7528\u9ED1\u8272\u548C\u767D\u8272"
+ }
+ },
+ experimental: {
+ heading: "\u{1F9EA} \u5B9E\u9A8C\u529F\u80FD",
+ description: "\u5371\u9669\u64CD\u4F5C\u6216\u6781\u5176\u4E0D\u7A33\u5B9A\u7684\u9009\u9879\uFF0C\u968F\u65F6\u53EF\u80FD\u4FEE\u6539\u6216\u79FB\u9664",
+ mixColors: {
+ name: "\u6DF7\u5408\u989C\u8272",
+ description: "\u6709\u52A9\u4E8E\u4FDD\u6301\u6587\u672C\u53EF\u8BFB"
+ },
+ gradientTransition: {
+ name: "\u6E10\u53D8\u8FC7\u6E21"
+ },
+ tagColors: {
+ name: "\u6807\u7B7E\u989C\u8272\u5206\u914D",
+ description: "\u8BF7\u4ECE\u5F53\u524D\u8C03\u8272\u677F\u4E2D\u9009\u62E9\u989C\u8272\u3002\u66F4\u6362\u8C03\u8272\u677F\u65F6\uFF0C\u6807\u7B7E\u4F1A\u81EA\u52A8\u9002\u914D\u6700\u63A5\u8FD1\u7684\u989C\u8272\u3002",
+ placeholder: "\u5F00\u59CB\u8F93\u5165\u6807\u7B7E",
+ clear: "\u91CD\u7F6E\u989C\u8272",
+ empty: "\u8FD8\u6CA1\u6709\u5206\u914D\u6807\u7B7E\u989C\u8272",
+ applyHint: "\u5E94\u7528\u989C\u8272"
+ },
+ reset: {
+ name: "\u91CD\u7F6E\u914D\u7F6E",
+ description: "\u{1F6A8} \u6240\u6709\u6807\u7B7E\u7684\u989C\u8272\u90FD\u4F1A\u91CD\u65B0\u8BA1\u7B97\uFF0C\u5C31\u50CF\u7B2C\u4E00\u6B21\u542F\u52A8\u63D2\u4EF6\u4E00\u6837\u3002\u9700\u8981\u91CD\u65B0\u542F\u52A8 Obsidian\u3002",
+ button: "\u91CD\u7F6E"
+ }
+ }
+ },
+ notices: {
+ updateAvailable: "\u2B06\uFE0F {{pluginName}}\uFF1A\u6709\u53EF\u7528\u7684\u65B0\u7248\u672C",
+ resetDone: "\u2705 \u91CD\u7F6E\u5B8C\u6210\n\u8BF7\u91CD\u65B0\u542F\u52A8 Obsidian",
+ communityPaletteApplied: "\u{1F3A8} \u5DF2\u5E94\u7528\u6765\u81EA {{author}} \u7684\u793E\u533A\u8C03\u8272\u677F"
+ }
+};
+
+// src/logger.ts
+var logger = {
+ warn: (message) => {
+ console.warn(message);
+ },
+ error: (message) => {
+ console.error(message);
+ },
+ log: (message) => {
+ console.log(message);
+ }
+};
+
+// src/i18n/index.ts
+var locales = {
+ en: en_default,
+ ru: ru_default,
+ de: de_default,
+ zh: zh_default,
+ es: es_default,
+ fr: fr_default,
+ it: it_default,
+ pt: pt_default,
+ ja: ja_default
+};
+var I18n = class {
+ static t(key, params) {
+ const locale = window.localStorage.getItem("language") || "en";
+ const keys = key.split(".");
+ let translations = locales[locale] || locales["en"];
+ for (const k of keys) {
+ if (typeof translations !== "object" || translations === null) {
+ logger.warn(`Translation missing: ${key}`);
+ translations = locales["en"];
+ return this.extractEnglishValue(keys, key);
+ }
+ if (translations[k] === void 0) {
+ logger.warn(`Translation missing: ${key}`);
+ translations = locales["en"];
+ return this.extractEnglishValue(keys, key);
+ }
+ translations = translations[k];
+ }
+ if (typeof translations !== "string") {
+ return key;
+ }
+ let result = translations;
+ if (params) {
+ Object.entries(params).forEach(([key2, value]) => {
+ const placeholder = new RegExp(`{{${key2}}}`, "g");
+ result = result.replace(placeholder, value);
+ });
+ }
+ return result;
+ }
+ static extractEnglishValue(keys, originalKey) {
+ let engValue = locales["en"];
+ for (const ek of keys) {
+ if (typeof engValue !== "object" || engValue === null) {
+ engValue = void 0;
+ break;
+ }
+ if (engValue[ek] === void 0) {
+ engValue = void 0;
+ break;
+ }
+ engValue = engValue[ek];
+ }
+ if (typeof engValue === "string") {
+ return engValue;
+ }
+ return originalKey;
+ }
+};
+
+// src/tagUtils.ts
+function normalizeTagName(tagName) {
+ return tagName.replace(/#/g, "").trim().replace(/\s+/g, "").replace(/\/+$/, "").toLowerCase();
+}
+function normalizePaletteIndex(index, length) {
+ if (length <= 0) {
+ return 0;
+ }
+ const normalized = index % length;
+ return normalized < 0 ? normalized + length : normalized;
+}
+
+// src/CommunityPalettesService.ts
+var import_obsidian = require("obsidian");
+var DISCUSSION_COMMENTS_URL = "https://api.github.com/repos/pfrankov/obsidian-colored-tags/discussions/18/comments";
+var PER_PAGE = 100;
+var POSITIVE_REACTIONS = [
+ "+1",
+ "heart",
+ "hooray",
+ "rocket",
+ "eyes",
+ "laugh"
+];
+var NEGATIVE_REACTIONS = ["-1", "confused"];
+var CommunityPalettesService = class {
+ static async getCommunityPalettes() {
+ if (this.cache) {
+ return this.cache;
+ }
+ if (this.pendingRequest) {
+ return this.pendingRequest;
+ }
+ this.pendingRequest = this.fetchCommunityPalettes().then((palettes) => {
+ this.cache = palettes;
+ return palettes;
+ }).finally(() => {
+ this.pendingRequest = void 0;
+ });
+ return this.pendingRequest;
+ }
+ static async fetchCommunityPalettes() {
+ const palettes = await this.collectPalettes(
+ 1,
+ [],
+ /* @__PURE__ */ new Set(),
+ /* @__PURE__ */ new Set()
+ );
+ return palettes.sort((a2, b2) => {
+ if (a2.score === b2.score) {
+ return a2.order - b2.order;
+ }
+ return b2.score - a2.score;
+ }).map(({ order: _order, ...palette }) => palette);
+ }
+ static async collectPalettes(page, palettes, uniqueValues, authorsWithPalette) {
+ var _a;
+ const response = await this.requestPage(page);
+ if (!response) {
+ return palettes;
+ }
+ const comments = (_a = response.json) != null ? _a : [];
+ if (!comments.length) {
+ return palettes;
+ }
+ this.appendPalettesFromComments(
+ comments,
+ palettes,
+ uniqueValues,
+ authorsWithPalette
+ );
+ if (comments.length < PER_PAGE) {
+ return palettes;
+ }
+ return this.collectPalettes(
+ page + 1,
+ palettes,
+ uniqueValues,
+ authorsWithPalette
+ );
+ }
+ static async requestPage(page) {
+ try {
+ const response = await (0, import_obsidian.requestUrl)({
+ url: `${DISCUSSION_COMMENTS_URL}?per_page=${PER_PAGE}&page=${page}`,
+ headers: {
+ Accept: "application/vnd.github+json"
+ },
+ throw: false
+ });
+ if (response.status !== 200) {
+ console.error(
+ `GitHub API responded with ${response.status} on page ${page}`
+ );
+ return null;
+ }
+ return response;
+ } catch (error) {
+ console.error("Failed to fetch community palettes", error);
+ return null;
+ }
+ }
+ static appendPalettesFromComments(comments, palettes, uniqueValues, authorsWithPalette) {
+ var _a, _b;
+ const scoredComments = comments.map((comment) => ({
+ comment,
+ score: this.getReactionScore(comment.reactions)
+ })).filter(({ score }) => score >= 0);
+ for (const { comment, score } of scoredComments) {
+ const author = ((_a = comment.user) == null ? void 0 : _a.login) || "unknown";
+ if (authorsWithPalette.has(author)) {
+ continue;
+ }
+ const palettesFromComment = this.extractPalettesFromBody(
+ comment.body || ""
+ );
+ const [value] = palettesFromComment;
+ if (!value || uniqueValues.has(value)) {
+ continue;
+ }
+ uniqueValues.add(value);
+ authorsWithPalette.add(author);
+ palettes.push({
+ id: `${comment.id}-0`,
+ value,
+ colors: value.split("-").filter(Boolean).map((hex) => `#${hex}`),
+ author,
+ authorUrl: (_b = comment.user) == null ? void 0 : _b.html_url,
+ commentUrl: comment.html_url,
+ score,
+ order: palettes.length
+ });
+ }
+ }
+ static extractPalettesFromBody(body) {
+ const regex = /\b([0-9a-fA-F]{6}(?:-[0-9a-fA-F]{6})+)\b/g;
+ const results = /* @__PURE__ */ new Set();
+ let match;
+ while ((match = regex.exec(body)) !== null) {
+ results.add(match[1].toLowerCase());
+ }
+ return Array.from(results);
+ }
+ static getReactionScore(reactions) {
+ if (!reactions) {
+ return 0;
+ }
+ const positive = POSITIVE_REACTIONS.reduce((total, key) => {
+ var _a;
+ return total + ((_a = reactions[key]) != null ? _a : 0);
+ }, 0);
+ const negative = NEGATIVE_REACTIONS.reduce((total, key) => {
+ var _a;
+ return total + ((_a = reactions[key]) != null ? _a : 0);
+ }, 0);
+ return positive - negative;
+ }
+};
+CommunityPalettesService.cache = null;
+
+// src/ColoredTagsPluginSettingTab.ts
+var SELECTED_CLASS = "is-selected";
+var ColoredTagsPluginSettingTab = class extends import_obsidian2.PluginSettingTab {
+ constructor(app, plugin) {
+ super(app, plugin);
+ this.showExperimental = false;
+ this.showAccessibility = false;
+ this.communityPaletteDescriptionCounter = 0;
+ this.communityPaletteCards = /* @__PURE__ */ new Map();
+ this.paletteChangeSubscribers = [];
+ this.plugin = plugin;
+ }
+ renderPalette(paletteEl, animate = false) {
+ paletteEl.empty();
+ const palette = this.getActivePalette();
+ palette.forEach((paletteColor, index) => {
+ const firstElementStyles = "border-radius: var(--radius-m) 0 0 var(--radius-m)";
+ const lastElementStyles = "border-radius: 0 var(--radius-m) var(--radius-m) 0";
+ const styles = [
+ index === 0 && firstElementStyles,
+ "flex: 1",
+ "height: 2em",
+ `background-color: ${paletteColor}`,
+ index === palette.length - 1 && lastElementStyles
+ ];
+ paletteEl.createEl("div", {
+ attr: { style: styles.filter(Boolean).join(";") }
+ });
+ });
+ if (animate && paletteEl.animate) {
+ paletteEl.animate([{ opacity: 0.2 }, { opacity: 1 }], {
+ duration: 220,
+ easing: "ease-out"
+ });
+ }
+ }
+ renderTags(containerEl) {
+ const tagsObject = this.app.metadataCache.getTags();
+ const tagsArray = Object.keys(tagsObject);
+ if (!tagsArray.length) {
+ return;
+ }
+ const tagEl = containerEl.createEl("div", {
+ cls: "tagsExample"
+ });
+ tagsArray.sort((a2, b2) => {
+ return tagsObject[b2] - tagsObject[a2];
+ });
+ const mostPopularTags = tagsArray.splice(0, 2);
+ const mostPopularNestedTags = Object.values(
+ tagsArray.reduce((acc, tag) => {
+ const nestingLevel = tag.split("/").length;
+ if (!acc[nestingLevel]) {
+ acc[nestingLevel] = tag;
+ }
+ return acc;
+ }, {})
+ );
+ [...mostPopularTags, ...mostPopularNestedTags].forEach(
+ (tag) => {
+ const link = tagEl.createEl("a", { attr: { href: tag } });
+ link.classList.add("tag");
+ link.innerText = tag;
+ }
+ );
+ }
+ display() {
+ const { containerEl } = this;
+ containerEl.empty();
+ containerEl.classList.add("colored-tags-settings");
+ this.paletteChangeSubscribers = [];
+ this.renderTags(containerEl);
+ const paletteEl = containerEl.createEl("div", {
+ cls: "palette"
+ });
+ this.renderPalette(paletteEl);
+ this.renderPaletteSettings(containerEl, paletteEl);
+ this.renderAccessibilitySettings(containerEl);
+ this.renderExperimentalSettings(containerEl);
+ }
+ renderPaletteSettings(containerEl, paletteEl) {
+ new import_obsidian2.Setting(containerEl).setHeading().setName(I18n.t("settings.palette.heading")).setDesc(I18n.t("settings.palette.description")).addDropdown(
+ (dropdown) => dropdown.addOptions({
+ ["adaptive-soft" /* ADAPTIVE_SOFT */]: I18n.t(
+ "settings.palette.options.adaptiveSoft"
+ ),
+ ["adaptive-bright" /* ADAPTIVE_BRIGHT */]: I18n.t(
+ "settings.palette.options.adaptiveBright"
+ ),
+ ["custom" /* CUSTOM */]: I18n.t(
+ "settings.palette.options.custom"
+ )
+ }).setValue(String(this.plugin.settings.palette.selected)).onChange(async (value) => {
+ this.plugin.settings.palette.selected = value;
+ await this.plugin.saveSettings();
+ this.display();
+ })
+ );
+ if (this.plugin.settings.palette.selected === "custom") {
+ this.renderCustomPaletteField(containerEl, paletteEl);
+ }
+ new import_obsidian2.Setting(containerEl).setName(I18n.t("settings.palette.shift.name")).setDesc(I18n.t("settings.palette.shift.description")).addSlider(
+ (slider) => slider.setLimits(0, this.plugin.palettes.light.length - 1, 1).setValue(this.plugin.settings.palette.seed).onChange(async (value) => {
+ slider.showTooltip();
+ this.plugin.settings.palette.seed = value;
+ await this.plugin.saveSettings();
+ this.renderPalette(paletteEl);
+ this.notifyPaletteChange();
+ })
+ );
+ }
+ renderCustomPaletteField(containerEl, paletteEl) {
+ let customPaletteInput = null;
+ const customPaletteField = new import_obsidian2.Setting(containerEl).setName(I18n.t("settings.palette.custom.name")).setDesc("").addText((text) => {
+ customPaletteInput = text;
+ text.inputEl.style.minWidth = "100%";
+ text.setValue(
+ this.plugin.settings.palette.custom
+ ).setPlaceholder(I18n.t("settings.palette.custom.placeholder"));
+ text.onChange(async (value) => {
+ if (/^([A-Fa-f0-9]{6}(-|$))+$/i.test(value)) {
+ this.plugin.settings.palette.custom = value;
+ await this.plugin.saveSettings();
+ this.renderPalette(paletteEl);
+ this.notifyPaletteChange();
+ this.updateCommunityPaletteSelection();
+ }
+ });
+ });
+ customPaletteField.descEl.innerHTML = I18n.t(
+ "settings.palette.custom.description"
+ );
+ if (customPaletteInput) {
+ this.renderCommunityPalettesSection(
+ containerEl,
+ paletteEl,
+ customPaletteInput
+ );
+ }
+ }
+ renderCommunityPalettesSection(containerEl, paletteEl, inputComponent) {
+ this.communityPaletteDescriptionCounter = 0;
+ this.communityPaletteCards = /* @__PURE__ */ new Map();
+ const sectionSetting = new import_obsidian2.Setting(containerEl).setName(I18n.t("settings.palette.custom.community.heading")).setDesc("");
+ sectionSetting.settingEl.classList.add("community-palettes");
+ const descEl = sectionSetting.descEl;
+ descEl.empty();
+ const communityLinkStart = '';
+ const communityLinkEnd = "";
+ const descriptionEl = descEl.createDiv({
+ cls: "community-palettes__description"
+ });
+ descriptionEl.innerHTML = I18n.t(
+ "settings.palette.custom.community.description",
+ { communityLinkStart, communityLinkEnd }
+ );
+ const scrollContainer = descEl.createDiv({
+ cls: "community-palettes__scroll"
+ });
+ const gridEl = scrollContainer.createDiv({
+ cls: "community-palettes__grid"
+ });
+ const statusEl = scrollContainer.createDiv({
+ cls: "community-palettes__status",
+ text: I18n.t("settings.palette.custom.community.loading")
+ });
+ CommunityPalettesService.getCommunityPalettes().then((palettes) => {
+ if (!palettes.length) {
+ statusEl.textContent = I18n.t(
+ "settings.palette.custom.community.empty"
+ );
+ return;
+ }
+ statusEl.remove();
+ palettes.forEach((palette) => {
+ const card = this.renderCommunityPaletteCard(
+ gridEl,
+ palette,
+ paletteEl,
+ inputComponent
+ );
+ this.communityPaletteCards.set(
+ this.normalizePaletteValue(palette.value),
+ card
+ );
+ });
+ this.updateCommunityPaletteSelection();
+ }).catch((error) => {
+ console.error(error);
+ statusEl.textContent = I18n.t(
+ "settings.palette.custom.community.error"
+ );
+ });
+ }
+ renderCommunityPaletteCard(gridEl, palette, paletteEl, inputComponent) {
+ const descriptionId = `community-palette-desc-${this.communityPaletteDescriptionCounter++}`;
+ const card = gridEl.createDiv({
+ cls: "community-palette-card",
+ attr: {
+ role: "button",
+ tabindex: "0",
+ "aria-describedby": descriptionId,
+ "aria-pressed": "false"
+ }
+ });
+ card.createSpan({
+ cls: "visually-hidden",
+ attr: { id: descriptionId },
+ text: I18n.t("settings.palette.custom.community.applyHint")
+ });
+ const paletteRow = card.createDiv({
+ cls: "community-palette-card__preview"
+ });
+ palette.colors.forEach((color) => {
+ paletteRow.createDiv({
+ attr: {
+ style: `flex: 1; background-color: ${color};`
+ }
+ });
+ });
+ const metaEl = card.createDiv({
+ cls: "community-palette-card__meta"
+ });
+ metaEl.createSpan({
+ cls: "community-palette-card__author",
+ text: palette.author
+ });
+ metaEl.createSpan({
+ cls: "community-palette-card__upvotes",
+ text: `\u2764\uFE0F ${palette.score}`
+ });
+ const applyPalette = () => {
+ void this.applyCommunityPalette(palette, inputComponent, paletteEl);
+ };
+ card.addEventListener("click", applyPalette);
+ card.addEventListener("keydown", (event) => {
+ if (event.key === "Enter" || event.key === " ") {
+ event.preventDefault();
+ applyPalette();
+ }
+ });
+ return card;
+ }
+ async applyCommunityPalette(palette, inputComponent, paletteEl) {
+ this.plugin.settings.palette.custom = palette.value;
+ inputComponent.setValue(palette.value);
+ await this.plugin.saveSettings();
+ this.renderPalette(paletteEl, true);
+ this.notifyPaletteChange();
+ this.updateCommunityPaletteSelection();
+ new import_obsidian2.Notice(
+ I18n.t("notices.communityPaletteApplied", {
+ author: palette.author
+ }),
+ 4e3
+ );
+ }
+ normalizePaletteValue(value) {
+ return (value || "").replace(/#/g, "").replace(/\s+/g, "").trim().toLowerCase();
+ }
+ updateCommunityPaletteSelection() {
+ if (!this.communityPaletteCards.size) {
+ return;
+ }
+ const isCustomSelected = this.plugin.settings.palette.selected === "custom" /* CUSTOM */;
+ const normalizedCustom = isCustomSelected ? this.normalizePaletteValue(this.plugin.settings.palette.custom) : "";
+ const hasMatch = Boolean(normalizedCustom);
+ this.communityPaletteCards.forEach((card, value) => {
+ const isSelected = hasMatch && value === normalizedCustom;
+ if (isSelected) {
+ card.classList.add(SELECTED_CLASS);
+ } else {
+ card.classList.remove(SELECTED_CLASS);
+ }
+ card.setAttribute("aria-pressed", isSelected ? "true" : "false");
+ });
+ }
+ renderAccessibilitySettings(containerEl) {
+ new import_obsidian2.Setting(containerEl).setHeading().setName(I18n.t("settings.accessibility.heading")).setDesc(I18n.t("settings.accessibility.description")).addToggle(
+ (toggle) => toggle.setValue(this.showAccessibility).onChange(async (value) => {
+ this.showAccessibility = value;
+ this.display();
+ })
+ );
+ if (this.showAccessibility) {
+ new import_obsidian2.Setting(containerEl).setName(I18n.t("settings.accessibility.highTextContrast.name")).setDesc(
+ I18n.t(
+ "settings.accessibility.highTextContrast.description"
+ )
+ ).addToggle(
+ (toggle) => toggle.setValue(
+ this.plugin.settings.accessibility.highTextContrast
+ ).onChange(async (value) => {
+ this.plugin.settings.accessibility.highTextContrast = value;
+ await this.plugin.saveSettings();
+ this.display();
+ })
+ );
+ }
+ }
+ renderExperimentalSettings(containerEl) {
+ new import_obsidian2.Setting(containerEl).setHeading().setName(I18n.t("settings.experimental.heading")).setDesc(I18n.t("settings.experimental.description")).addToggle(
+ (toggle) => toggle.setValue(this.showExperimental).onChange(async (value) => {
+ this.showExperimental = value;
+ this.display();
+ })
+ );
+ if (!this.showExperimental) {
+ return;
+ }
+ new import_obsidian2.Setting(containerEl).setName(I18n.t("settings.experimental.mixColors.name")).setDesc(I18n.t("settings.experimental.mixColors.description")).addToggle(
+ (toggle) => toggle.setValue(this.plugin.settings.mixColors).onChange(async (value) => {
+ this.plugin.settings.mixColors = value;
+ await this.plugin.saveSettings();
+ this.display();
+ })
+ );
+ new import_obsidian2.Setting(containerEl).setName(I18n.t("settings.experimental.gradientTransition.name")).addToggle(
+ (toggle) => toggle.setValue(this.plugin.settings.transition).onChange(async (value) => {
+ this.plugin.settings.transition = value;
+ await this.plugin.saveSettings();
+ this.display();
+ })
+ );
+ this.renderTagPaletteOverrides(containerEl);
+ new import_obsidian2.Setting(containerEl).setName(I18n.t("settings.experimental.reset.name")).setDesc(I18n.t("settings.experimental.reset.description")).addButton(
+ (button) => button.setButtonText(I18n.t("settings.experimental.reset.button")).setClass("mod-warning").onClick(async () => {
+ new import_obsidian2.Notice(I18n.t("notices.resetDone"), 1e4);
+ button.setDisabled(true);
+ button.buttonEl.setAttribute("disabled", "true");
+ button.buttonEl.classList.remove("mod-warning");
+ this.plugin.settings = Object.assign(
+ {},
+ DEFAULT_SETTINGS
+ );
+ await this.plugin.saveSettings();
+ this.updateCommunityPaletteSelection();
+ })
+ );
+ }
+ renderTagPaletteOverrides(containerEl) {
+ const tagPaletteSetting = new import_obsidian2.Setting(containerEl).setName(I18n.t("settings.experimental.tagColors.name")).setDesc(I18n.t("settings.experimental.tagColors.description"));
+ tagPaletteSetting.settingEl.classList.add("tag-color-setting-item");
+ tagPaletteSetting.controlEl.empty();
+ const wrapper = tagPaletteSetting.controlEl.createDiv({
+ cls: "tag-color-setting"
+ });
+ const controlsRow = wrapper.createDiv({
+ cls: "tag-color-setting__row"
+ });
+ const inputContainer = controlsRow.createDiv({
+ cls: "tag-color-setting__input"
+ });
+ const datalistId = `tag-color-list-${Date.now()}`;
+ const datalist = inputContainer.createEl("datalist", {
+ attr: { id: datalistId }
+ });
+ const refreshTagOptions = () => this.populateTagOptions(datalist);
+ refreshTagOptions();
+ let currentTag = "";
+ const tagInput = new import_obsidian2.TextComponent(inputContainer);
+ tagInput.setPlaceholder(
+ I18n.t("settings.experimental.tagColors.placeholder")
+ ).setValue("");
+ tagInput.inputEl.setAttr("list", datalistId);
+ tagInput.onChange((value) => {
+ currentTag = normalizeTagName(value);
+ updateSelectedSwatch();
+ });
+ const paletteEl = controlsRow.createDiv({
+ cls: "tag-color-setting__palette"
+ });
+ const listContainer = wrapper.createDiv({
+ cls: "tag-color-setting__chips"
+ });
+ const handleAssignmentsChange = () => {
+ updateSelectionState();
+ refreshTagOptions();
+ };
+ const updateSelectedSwatch = () => {
+ var _a;
+ const palette = this.getActivePalette();
+ const assignedIndex = (_a = this.plugin.settings.tagColors && this.plugin.settings.tagColors[currentTag]) != null ? _a : null;
+ Array.from(paletteEl.children).forEach((child, index) => {
+ child.classList.toggle(
+ SELECTED_CLASS,
+ assignedIndex !== null && assignedIndex !== void 0 && normalizePaletteIndex(assignedIndex, palette.length) === index
+ );
+ child.disabled = !currentTag;
+ });
+ };
+ const updateSelectionState = () => {
+ updateSelectedSwatch();
+ };
+ const applySelection = async (index) => {
+ if (!currentTag) {
+ return;
+ }
+ this.plugin.settings.tagColors[currentTag] = index;
+ await this.plugin.saveSettings();
+ this.plugin.colorizeTag(currentTag);
+ this.renderTagColorAssignments(
+ listContainer,
+ handleAssignmentsChange
+ );
+ };
+ this.renderPaletteSwatches(paletteEl, applySelection);
+ this.renderTagColorAssignments(listContainer, handleAssignmentsChange);
+ this.subscribeToPaletteChange(() => {
+ this.renderPaletteSwatches(paletteEl, applySelection);
+ this.renderTagColorAssignments(
+ listContainer,
+ handleAssignmentsChange
+ );
+ updateSelectionState();
+ });
+ updateSelectionState();
+ }
+ renderPaletteSwatches(paletteEl, onSelect) {
+ paletteEl.empty();
+ const palette = this.getActivePalette();
+ palette.forEach((color, index) => {
+ const swatch = paletteEl.createEl("button", {
+ cls: "tag-color-setting__swatch",
+ attr: {
+ type: "button",
+ style: `background-color: ${color}`,
+ "aria-label": `${I18n.t(
+ "settings.experimental.tagColors.applyHint"
+ )} ${index + 1}`
+ }
+ });
+ swatch.addEventListener("click", () => onSelect(index));
+ });
+ }
+ renderTagColorAssignments(listEl, onChange) {
+ listEl.empty();
+ const entries = Object.entries(this.plugin.settings.tagColors || {});
+ if (!entries.length) {
+ listEl.createDiv({
+ cls: "tag-color-setting__empty",
+ text: I18n.t("settings.experimental.tagColors.empty")
+ });
+ onChange == null ? void 0 : onChange();
+ return;
+ }
+ entries.sort(([tagA], [tagB]) => tagA.localeCompare(tagB)).forEach(([tag]) => {
+ const chipWrapper = listEl.createDiv({
+ cls: "tag-color-setting__chip"
+ });
+ const chip = chipWrapper.createEl("a", {
+ cls: "tag",
+ text: `#${tag}`,
+ attr: {
+ href: `#${tag}`
+ }
+ });
+ chip.addEventListener("click", (event) => {
+ var _a;
+ event.preventDefault();
+ const tagInputEl = (_a = listEl.closest(".tag-color-setting")) == null ? void 0 : _a.querySelector(
+ ".tag-color-setting__input input"
+ );
+ if (tagInputEl) {
+ tagInputEl.value = `#${tag}`;
+ tagInputEl.dispatchEvent(new Event("input"));
+ }
+ });
+ const removeButton = chipWrapper.createEl("button", {
+ cls: "tag-color-setting__chip-remove",
+ attr: {
+ type: "button",
+ "aria-label": I18n.t(
+ "settings.experimental.tagColors.clear"
+ ),
+ title: I18n.t("settings.experimental.tagColors.clear")
+ },
+ text: "\u2715"
+ });
+ removeButton.addEventListener("click", async (event) => {
+ event.preventDefault();
+ event.stopPropagation();
+ delete this.plugin.settings.tagColors[tag];
+ await this.plugin.saveSettings();
+ this.renderTagColorAssignments(listEl, onChange);
+ });
+ });
+ onChange == null ? void 0 : onChange();
+ }
+ populateTagOptions(datalist) {
+ var _a, _b;
+ datalist.empty();
+ const knownTags = new Set(
+ Object.keys(this.plugin.settings.knownTags || {})
+ );
+ const assignedTags = new Set(
+ Object.keys(this.plugin.settings.tagColors || {})
+ );
+ const metadataTags = Object.keys(
+ ((_b = (_a = this.app.metadataCache) == null ? void 0 : _a.getTags) == null ? void 0 : _b.call(_a)) || {}
+ ).map((tag) => normalizeTagName(tag)).filter((tag) => tag.length > 0);
+ metadataTags.forEach((tag) => knownTags.add(tag));
+ Array.from(knownTags).filter((tag) => !assignedTags.has(tag)).sort((a2, b2) => a2.localeCompare(b2)).forEach((tag) => {
+ datalist.createEl("option", {
+ attr: { value: `#${tag}` }
+ });
+ });
+ }
+ getActivePalette() {
+ let palette = this.plugin.palettes.light;
+ if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
+ palette = this.plugin.palettes.dark;
+ }
+ return palette.length ? palette : this.plugin.palettes.light;
+ }
+ subscribeToPaletteChange(callback) {
+ this.paletteChangeSubscribers.push(callback);
+ }
+ notifyPaletteChange() {
+ this.paletteChangeSubscribers.forEach((cb) => cb());
+ }
+};
+
// node_modules/colorjs.io/dist/color.js
function multiplyMatrices(A, B) {
let m3 = A.length;
@@ -3089,265 +4671,426 @@ Color.extend(luminance);
Color.extend(interpolation);
Color.extend(contrastMethods);
-// src/coloredClassApplyerPlugin.ts
-var import_view = require("@codemirror/view");
-function coloredClassApplyer(domElement) {
- const tagElements = [];
- let hashEl = null;
- [].forEach.call(domElement.getElementsByClassName("cm-hashtag"), (el) => {
- if (el.innerText === "#") {
- hashEl = el;
- return;
+// src/ColorService.ts
+var ColorService = class {
+ constructor() {
+ this.darkenMemoization = /* @__PURE__ */ new Map();
+ }
+ generatePalettes(paletteConfig) {
+ if (paletteConfig.selected === "custom" /* CUSTOM */) {
+ const palette = paletteConfig.custom.split("-").filter(Boolean).map((str) => `#${str}`);
+ if (palette.length > 0) {
+ return {
+ light: this.processColorPalette({
+ isDarkTheme: false,
+ palette,
+ seed: paletteConfig.seed
+ }),
+ dark: this.processColorPalette({
+ isDarkTheme: true,
+ palette,
+ seed: paletteConfig.seed
+ })
+ };
+ }
}
- tagElements.push({
- el,
- hashEl,
- className: `colored-tag-${el.innerText.trim().toLowerCase()}`
+ const isBright = paletteConfig.selected === "adaptive-bright" /* ADAPTIVE_BRIGHT */;
+ const baseChroma = isBright ? 85 : 16;
+ const baseLightness = isBright ? 75 : 87;
+ const offset = 35;
+ const commonConfig = {
+ paletteSize: 8,
+ seed: paletteConfig.seed,
+ isShuffling: true,
+ baseChroma,
+ baseLightness,
+ constantOffset: offset
+ };
+ return {
+ light: this.generateAdaptiveColorPalette({
+ isDarkTheme: false,
+ ...commonConfig
+ }),
+ dark: this.generateAdaptiveColorPalette({
+ isDarkTheme: true,
+ ...commonConfig
+ })
+ };
+ }
+ getColors(tagName, palette, tagsMap, options, tagColorOverrides) {
+ const chunks = tagName.split("/");
+ const gradientStops = this.calculateGradientStops(
+ chunks,
+ palette,
+ tagsMap,
+ options.isMixing,
+ options.isTransition,
+ tagColorOverrides
+ );
+ const backgroundColor = new Color(gradientStops[0]);
+ const background = backgroundColor.toString({ format: "lch" });
+ const linearGradient = this.buildLinearGradient(
+ gradientStops,
+ options.isTransition
+ );
+ const color = options.highTextContrast ? this.calculateHighContrastColor(backgroundColor) : this.calculateDarkenedColor(backgroundColor);
+ return { background, color, linearGradient };
+ }
+ calculateGradientStops(chunks, palette, tagsMap, isMixing, isTransition, tagColorOverrides) {
+ const gradientStops = [];
+ let backgroundColor = null;
+ let lastColor = "";
+ let currentPath = "";
+ for (const chunk of chunks) {
+ const key = this.composeTagPath(currentPath, chunk);
+ const order = tagsMap.get(key) || 1;
+ const overrideIndex = tagColorOverrides == null ? void 0 : tagColorOverrides.get(key);
+ const paletteForChunk = this.getPaletteForChunk(
+ palette,
+ lastColor,
+ overrideIndex
+ );
+ const colorFromPalette = this.pickColorFromPalette(
+ paletteForChunk,
+ order,
+ overrideIndex
+ );
+ lastColor = colorFromPalette;
+ const newColor = this.buildColorForChunk(
+ backgroundColor,
+ colorFromPalette,
+ isMixing,
+ isTransition
+ );
+ if (!backgroundColor) {
+ backgroundColor = newColor;
+ }
+ gradientStops.push(newColor.toString({ format: "lch" }));
+ currentPath = key;
+ }
+ return gradientStops;
+ }
+ composeTagPath(parentPath, chunk) {
+ return parentPath ? `${parentPath}/${chunk}` : chunk;
+ }
+ getPaletteForChunk(palette, lastColor, overrideIndex) {
+ if (overrideIndex !== void 0 || palette.length <= 1) {
+ return palette;
+ }
+ const filtered = palette.filter((color) => color !== lastColor);
+ return filtered.length > 0 ? filtered : palette;
+ }
+ pickColorFromPalette(palette, order, overrideIndex) {
+ const indexSource = overrideIndex !== void 0 ? overrideIndex : order - 1;
+ const index = normalizePaletteIndex(indexSource, palette.length);
+ return palette[index];
+ }
+ buildColorForChunk(backgroundColor, colorFromPalette, isMixing, isTransition) {
+ if (backgroundColor && isMixing) {
+ return this.mixColors(
+ backgroundColor,
+ colorFromPalette,
+ isTransition
+ );
+ }
+ return new Color(colorFromPalette).to("lch");
+ }
+ mixColors(baseColor, newColorStr, isTransition) {
+ const mixingLevel = isTransition ? 0.5 : 0.4;
+ let mixed = baseColor.mix(newColorStr, mixingLevel, { space: "lch" });
+ if (mixed.deltaE2000(baseColor) < 10) {
+ mixed = baseColor.mix(newColorStr, mixingLevel + 0.1, {
+ space: "lch"
+ });
+ }
+ return mixed;
+ }
+ buildLinearGradient(gradientStops, isTransition) {
+ const defaultGap = isTransition ? 50 : 0;
+ const gap = defaultGap / gradientStops.length * 2;
+ const sumOfGaps = gap * (gradientStops.length - 1);
+ const elementSize = (100 - sumOfGaps) / gradientStops.length;
+ return gradientStops.map((color, index) => {
+ const start = index * (elementSize + gap);
+ const end = start + elementSize;
+ return `${color} ${start}% max(2em, ${end}%)`;
});
- });
- tagElements.forEach(({ el, hashEl: hashEl2, className }) => {
- el.classList.forEach((cls) => {
- if (cls.startsWith("colored-tag-") && cls !== className) {
- el.classList.remove(cls);
- hashEl2.classList.remove(cls);
+ }
+ calculateHighContrastColor(backgroundColor) {
+ const whiteColor = new Color("white");
+ const blackColor = new Color("black");
+ const onWhite = Math.abs(backgroundColor.contrast(whiteColor, "APCA"));
+ const onBlack = Math.abs(backgroundColor.contrast(blackColor, "APCA"));
+ return (onWhite > onBlack ? whiteColor : blackColor).toString();
+ }
+ calculateDarkenedColor(baseColor) {
+ const CONTRAST = 4.5;
+ const memoKey = baseColor.toString();
+ const cached = this.darkenMemoization.get(memoKey);
+ if (cached) {
+ return cached;
+ }
+ const colorLight = new Color(baseColor).to("lch");
+ const colorDark = new Color(baseColor).to("lch");
+ colorLight.c = Math.min(colorLight.c + 3, 100);
+ colorDark.c = Math.min(colorDark.c + 20, 100);
+ let result = "#fff";
+ for (let i = 0; i < 100; i++) {
+ if (baseColor.contrastAPCA(colorLight) <= -60 && colorLight.contrastWCAG21(baseColor) >= CONTRAST) {
+ result = colorLight.toString();
+ break;
+ }
+ if (baseColor.contrastAPCA(colorDark) >= 60 && colorDark.contrastWCAG21(baseColor) >= CONTRAST) {
+ result = colorDark.toString();
+ break;
+ }
+ colorLight.l++;
+ colorDark.l--;
+ }
+ this.darkenMemoization.set(memoKey, result);
+ return result;
+ }
+ generateAdaptiveColorPalette(config) {
+ const hueIncrement = 360 / config.paletteSize;
+ const availableColors = [];
+ for (let i = 0; i < config.paletteSize; i++) {
+ const hue = i * hueIncrement + config.constantOffset;
+ const chroma = config.isDarkTheme ? Math.min(Math.round(config.baseChroma * 1.8), 100) : config.baseChroma;
+ const lightness = config.isDarkTheme ? Math.min(Math.round(config.baseLightness / 2.5), 100) : config.baseLightness;
+ const lchColor = new Color("lch", [
+ lightness,
+ chroma,
+ hue % 360
+ ]).toString();
+ availableColors.push(lchColor);
+ }
+ if (!config.isShuffling) {
+ return availableColors;
+ }
+ const result = [];
+ const available = [...availableColors];
+ let next = 0;
+ while (available.length > 0) {
+ result.push(available[next]);
+ available.splice(next, 1);
+ next = Math.round(next + available.length / 3) % available.length;
+ }
+ return this.rotatePalette(result, config.seed);
+ }
+ processColorPalette(config) {
+ const availableColors = config.palette.map(
+ (item) => new Color(item).to("lch").toString()
+ );
+ return this.rotatePalette(availableColors, config.seed);
+ }
+ rotatePalette(colors, seed) {
+ const result = [...colors];
+ const cut = result.splice(-seed, seed);
+ result.splice(0, 0, ...cut);
+ return result;
+ }
+ findClosestColorIndex(sourceColor, palette) {
+ if (!palette.length) {
+ return 0;
+ }
+ const source = new Color(sourceColor);
+ let bestIndex = 0;
+ let bestDistance = Number.POSITIVE_INFINITY;
+ palette.forEach((color, index) => {
+ const distance2 = source.deltaE2000(new Color(color));
+ if (distance2 < bestDistance) {
+ bestDistance = distance2;
+ bestIndex = index;
}
});
- if (!el.classList.contains(className)) {
- el.classList.add(className);
- hashEl2.classList.add(className);
- }
- });
-}
-var coloredClassApplyerPlugin = import_view.ViewPlugin.fromClass(
- class {
- constructor(view) {
- coloredClassApplyer(view.dom);
- }
- update(update) {
- coloredClassApplyer(update.view.dom);
- }
+ return bestIndex;
}
-);
-
-// src/ColoredTagsPluginSettingTab.ts
-var import_obsidian = require("obsidian");
-
-// src/defaultSettings.ts
-var DEFAULT_SETTINGS = {
- palette: {
- seed: 0,
- selected: "adaptive-soft" /* ADAPTIVE_SOFT */,
- custom: "e12729-f37324-f8cc1b-72b043-007f4e"
- },
- mixColors: true,
- transition: true,
- accessibility: {
- highTextContrast: false
- },
- knownTags: {},
- _version: 3
};
-// src/ColoredTagsPluginSettingTab.ts
-var ColoredTagsPluginSettingTab = class extends import_obsidian.PluginSettingTab {
- constructor(app, plugin) {
- super(app, plugin);
- this.showExperimental = false;
- this.showAccessibility = false;
- this.plugin = plugin;
+// src/CSSManager.ts
+var CSSManager = class {
+ constructor() {
+ this.appendBuffer = [];
+ this.isPending = false;
+ this.ATTRIBUTE = "colored-tags-style";
}
- renderPalette(paletteEl) {
- paletteEl.empty();
- let palette = this.plugin.palettes.light;
- if (window.matchMedia("(prefers-color-scheme: dark)").matches) {
- palette = this.plugin.palettes.dark;
- }
- palette.forEach((paletteColor, index) => {
- const firstElementStyles = "border-radius: var(--radius-m) 0 0 var(--radius-m)";
- const lastElementStyles = "border-radius: 0 var(--radius-m) var(--radius-m) 0";
- const styles = [
- index === 0 && firstElementStyles,
- "flex: 1",
- "height: 2em",
- `background-color: ${paletteColor}`,
- index === palette.length - 1 && lastElementStyles
- ];
- paletteEl.createEl("div", {
- attr: { style: styles.filter(Boolean).join(";") }
- });
- });
- }
- renderTags(containerEl) {
- const tagsObject = this.app.metadataCache.getTags();
- const tagsArray = Object.keys(tagsObject);
- if (!tagsArray.length) {
+ append(css) {
+ this.appendBuffer.push(css);
+ if (this.isPending) {
return;
}
- const tagEl = containerEl.createEl("div", {
- cls: "tagsExample",
- attr: {
- style: `display: flex; gap: 0.5em; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 1em 0 2em;`
- }
- });
- tagsArray.sort((a2, b2) => {
- return tagsObject[b2] - tagsObject[a2];
- });
- const mostPopularTags = tagsArray.splice(0, 2);
- const mostPopularNestedTags = Object.values(
- tagsArray.reduce((acc, tag) => {
- const nestingLevel = tag.split("/").length;
- if (!acc[nestingLevel]) {
- acc[nestingLevel] = tag;
- }
- return acc;
- }, {})
- );
- [...mostPopularTags, ...mostPopularNestedTags].forEach((tag) => {
- const link = tagEl.createEl("a", { attr: { href: tag } });
- link.classList.add("tag");
- link.innerText = tag;
+ this.isPending = true;
+ Promise.resolve().then(() => this.flush());
+ }
+ flush() {
+ let styleEl = document.head.querySelector(`[${this.ATTRIBUTE}]`);
+ if (!styleEl) {
+ styleEl = document.head.createEl("style", {
+ type: "text/css",
+ attr: { [this.ATTRIBUTE]: "" }
+ });
+ }
+ styleEl.appendText(this.appendBuffer.join("\n"));
+ this.appendBuffer = [];
+ this.isPending = false;
+ }
+ removeAll() {
+ document.head.querySelectorAll(`[${this.ATTRIBUTE}]`).forEach((el) => {
+ el.remove();
});
}
- display() {
- const { containerEl } = this;
- containerEl.empty();
- this.renderTags(containerEl);
- const paletteEl = containerEl.createEl("div", {
- cls: "palette",
- attr: { style: `display: flex; align-items: stretch` }
+};
+
+// src/TagManager.ts
+var TagManager = class {
+ constructor(knownTags) {
+ this.renderedTags = /* @__PURE__ */ new Set();
+ const normalized = Object.entries(knownTags || {}).reduce((acc, [tagName, order]) => {
+ const normalizedName = normalizeTagName(tagName);
+ if (normalizedName) {
+ acc.push([normalizedName, order]);
+ }
+ return acc;
+ }, []);
+ this.tagsMap = new Map(normalized);
+ }
+ getTagsMap() {
+ return this.tagsMap;
+ }
+ clearRenderedTags() {
+ this.renderedTags.clear();
+ }
+ markAsRendered(tagName) {
+ this.renderedTags.add(tagName);
+ }
+ isRendered(tagName) {
+ return this.renderedTags.has(tagName);
+ }
+ async updateKnownTags(metadataCache) {
+ const orderedTags = this.collectTagPaths(metadataCache);
+ const nextMap = this.buildOrders(orderedTags);
+ const hasChanges = this.hasChanged(nextMap);
+ if (hasChanges) {
+ this.tagsMap = nextMap;
+ }
+ return hasChanges;
+ }
+ collectTagPaths(metadataCache) {
+ const paths = /* @__PURE__ */ new Set();
+ Object.keys(metadataCache.getTags()).map((tag) => normalizeTagName(tag)).filter((tag) => tag.length > 0 && !tag.match(/\/$/)).forEach((tag) => {
+ const chunks = tag.split("/");
+ let combined = "";
+ for (const chunk of chunks) {
+ combined = combined ? `${combined}/${chunk}` : chunk;
+ paths.add(combined);
+ }
});
- this.renderPalette(paletteEl);
- new import_obsidian.Setting(containerEl).setHeading().setName("Palette").setDesc("Select palette").addDropdown(
- (dropdown) => dropdown.addOptions({
- ["adaptive-soft" /* ADAPTIVE_SOFT */]: "\u{1F338} Adaptive soft",
- ["adaptive-bright" /* ADAPTIVE_BRIGHT */]: "\u{1F33A} Adaptive bright",
- ["custom" /* CUSTOM */]: "Custom"
- }).setValue(String(this.plugin.settings.palette.selected)).onChange(async (value) => {
- this.plugin.settings.palette.selected = value;
- await this.plugin.saveSettings();
- this.display();
- })
- );
- if (this.plugin.settings.palette.selected === "custom") {
- const customPaletteField = new import_obsidian.Setting(containerEl).setName("Custom palette").setDesc("").addText((text) => {
- text.inputEl.style.minWidth = "100%";
- text.setValue(
- this.plugin.settings.palette.custom
- ).setPlaceholder("Paste palette");
- text.onChange(async (value) => {
- if (/^([A-Fa-f0-9]{6}(-|$))+$/i.test(value)) {
- this.plugin.settings.palette.custom = value;
- await this.plugin.saveSettings();
- this.renderPalette(paletteEl);
- }
- });
- });
- customPaletteField.descEl.innerHTML = `
- The format is XXXXXX-XXXXXX-XXXXXX for each RGB color.| Theme Colors | \n|||||||||
|---|---|---|---|---|---|---|---|---|---|
| \n | \n | \n | \n | \n | \n | \n | \n | \n | \n |
| \n | |||||||||
| \n | \n | \n | \n | \n | \n | \n | \n | \n | \n |
| \n | \n | \n | \n | \n | \n | \n | \n | \n | \n |
| \n | \n | \n | \n | \n | \n | \n | \n | \n | \n |
| \n | \n | \n | \n | \n | \n | \n | \n | \n | \n |
| \n | \n | \n | \n | \n | \n | \n | \n | \n | \n |
| \n | |||||||||
| Standard Colors | \n|||||||||
| \n | \n | \n | \n | \n | \n | \n | \n | \n | \n |
| Custom Font Colors | \n|||||||||
| \n | \n | \n | \n | \n | |||||
| Translucent Colors | \n||||
|---|---|---|---|---|
| \n | \n | \n | \n | \n |
| \n | \n | \n | \n | \n |
| Highlighter Colors | \n||||
| \n | \n | \n | \n | \n |
| \n | \n | \n | \n | \n |
| Custom Colors | \n||||
| \n | \n | \n | \n | \n |
e;){let i=!0,h=!1;if(!c||l>s[c-1].to){let t=Pi[l-1];t!=a&&(i=!1,h=16==t)}let d=i||1!=a?null:[],u=i?o:o+1,p=l;t:for(;;)if(c&&p==s[c-1].to){if(h)break t;let m=s[--c];if(!i)for(let t=m.from,i=c;;){if(t==e)break t;if(!i||s[i-1].to!=t){if(Pi[t-1]==a)break t;break}t=s[--i].from}if(d)d.push(m);else{m.to ',suffix:" ',suffix:" ',suffix:"{if(this.cache.add(t),t.isComposite())return!1},enter:t=>this.cache.add(t),leave:()=>{},break:()=>{}}}run(t,e){let i=e&&this.getCompositionContext(e.text);for(let o=0,n=0,s=0;;){let r=s=r?s-i:0,a=s+(a-r),r=s}else if(a=a?s-i:0,r=s+(r-a),a=s}return{from:s,toA:r,toB:a}}class kn{setSelectionOrigin(t){this.lastSelectionOrigin=t,this.lastSelectionTime=Date.now()}constructor(t){this.view=t,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=t.hasFocus,We.safari&&t.contentDOM.addEventListener("input",()=>null),We.gecko&&function(t){Yn.has(t)||(Yn.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}(t.contentDOM.ownerDocument)}handleEvent(t){(function(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let i,o=e.target;o!=t.contentDOM;o=o.parentNode)if(!o||11==o.nodeType||(i=Mo.get(o))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0})(this.view,t)&&!this.ignoreDuringComposition(t)&&("keydown"==t.type&&this.keydown(t)||(0!=this.view.updateState?Promise.resolve().then(()=>this.runHandlers(t.type,t)):this.runHandlers(t.type,t)))}runHandlers(t,e){let i=this.handlers[t];if(i){for(let t of i.observers)t(this.view,e);for(let t of i.handlers){if(e.defaultPrevented)break;if(t(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=Tn(t),i=this.handlers,o=this.view.contentDOM;for(let t in e)if("scroll"!=t){let n=!e[t].handlers.length,s=i[t];s&&n!=!s.handlers.length&&(o.removeEventListener(t,this.handleEvent),s=null),s||o.addEventListener(t,this.handleEvent,{passive:n})}for(let t in i)"scroll"==t||e[t]||o.removeEventListener(t,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),9==t.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=t.keyCode&&An.indexOf(t.keyCode)<0&&(this.tabFocusMode=-1),We.android&&We.chrome&&!t.synthetic&&(13==t.keyCode||8==t.keyCode))return this.view.observer.delayAndroidKey(t.key,t.keyCode),!0;let e;return!We.ios||t.synthetic||t.altKey||t.metaKey||!((e=En.find(e=>e.keyCode==t.keyCode))&&!t.ctrlKey||Mn.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(229!=t.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0)}flushIOSKey(t){let e=this.pendingIOSKey;return!!e&&(!("Enter"==e.key&&t&&t.fromt.from>=l.from&&t.to<=l.to&&Math.abs(t.from-o)n&&(o.push({from:n,to:t}),s+=t-n),n=e}},20),n{let i=[];for(let t of e.getTextFormats()){let e=t.underlineStyle,o=t.underlineThickness;if(!/none/i.test(e)&&!/none/i.test(o)){let n=this.toEditorPos(t.rangeStart),s=this.toEditorPos(t.rangeEnd);if(n{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:e}=this.composing;this.composing=null,e&&this.reset(t.state)}};for(let t in this.handlers)e.addEventListener(t,this.handlers[t]);this.measureReq={read:t=>{this.editContext.updateControlBounds(t.contentDOM.getBoundingClientRect());let e=ni(t.root);e&&e.rangeCount&&this.editContext.updateSelectionBounds(e.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let e=0,i=!1,o=this.pendingContextChange;return t.changes.iterChanges((n,s,r,a,l)=>{if(i)return;let c=l.length-(s-n);if(o&&s>=o.to){if(o.from==n&&o.to==s&&o.insert.eq(l))return o=this.pendingContextChange=null,e+=c,void(this.to+=c);o=null,this.revertPending(t.state)}if(n+=e,(s+=e)<=this.from)this.from+=c,this.to+=c;else if(n\n \n
\n\n \n Theme Colors \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Standard Colors \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Custom Font Colors \n \n \n \n \n \n \n \n \n \n \n
\n\n \n Translucent Colors \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n \n \n Highlighter Colors \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Custom Colors \n \n \n \n \n \n \n \n \n =s:n<=s))return o;if(o===Ya())break;o=tl(o,!1)}return!1}function Ka(t,e,i,o){for(var n=0,s=0,r=t.children;s