feat: Erklärungen als Hover-Tooltip bei Harmonietypen

This commit is contained in:
Ferdinand
2026-04-02 13:55:43 +02:00
parent 184f3ec0c2
commit cc4d612b33
2 changed files with 58 additions and 2 deletions

View File

@@ -1,13 +1,39 @@
import { getHarmonies, hslToHex } from './converter.js';
import { state } from './app.js';
const DESCRIPTIONS = {
'Komplementär': 'Die Farbe gegenüber auf dem Farbrad (180°). Starker Kontrast — gut für Akzente.',
'Analog': 'Zwei Nachbarfarben (±30°). Wirkt harmonisch und ruhig — gut für Hintergründe.',
'Triade': 'Drei gleichmäßig verteilte Farben (120° Abstand). Lebendig, aber ausgewogen.',
'Split-Komplementär': 'Die zwei Farben neben der Komplementärfarbe (150°/210°). Weniger Spannung als Komplementär, mehr Vielfalt.',
};
function renderHarmony(label, colors, onSaveFavorit, onSaveSchema) {
const row = document.createElement('div');
row.className = 'harmony-row';
const headerRow = document.createElement('div');
headerRow.className = 'harmony-header';
const heading = document.createElement('h3');
heading.textContent = label;
row.appendChild(heading);
const infoWrap = document.createElement('span');
infoWrap.className = 'harmony-info';
const infoIcon = document.createElement('span');
infoIcon.className = 'harmony-info-icon';
infoIcon.textContent = '';
const tooltip = document.createElement('span');
tooltip.className = 'harmony-tooltip';
tooltip.textContent = DESCRIPTIONS[label] || '';
infoWrap.appendChild(infoIcon);
infoWrap.appendChild(tooltip);
headerRow.appendChild(heading);
headerRow.appendChild(infoWrap);
row.appendChild(headerRow);
const swatchesDiv = document.createElement('div');
swatchesDiv.className = 'harmony-swatches';