Add Key Colors target type for extracting colors from screen regions

Introduce a new "key_colors" target type alongside WLED targets, enabling
real-time color extraction from configurable screen rectangles with
average/median/dominant modes, temporal smoothing, and WebSocket streaming.

- Split WledPictureTarget into its own module, add KeyColorsPictureTarget
- Add KC target lifecycle to ProcessorManager (register, start/stop, processing loop)
- Extend API routes and schemas for KC targets (CRUD, settings, state, metrics, colors)
- Add WebSocket endpoint for real-time color updates with auth
- Add KC sub-tab in Targets UI with editor modal and live color swatches
- Add EN and RU translations for all key colors strings

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-12 16:43:09 +03:00
parent 3d2393e474
commit 5f9bc9a37e
13 changed files with 1525 additions and 111 deletions

View File

@@ -2583,3 +2583,126 @@ input:-webkit-autofill:focus {
font-size: 0.7rem;
}
/* Key Colors target styles */
.kc-rect-list {
display: flex;
flex-direction: column;
gap: 8px;
margin-bottom: 8px;
}
.kc-rect-row {
display: flex;
align-items: center;
gap: 6px;
padding: 8px;
background: var(--bg-color);
border: 1px solid var(--border-color);
border-radius: 6px;
}
.kc-rect-row input[type="text"] {
flex: 2;
min-width: 0;
}
.kc-rect-row input[type="number"] {
flex: 1;
min-width: 0;
width: 60px;
}
.kc-rect-row .kc-rect-remove-btn {
background: none;
border: none;
color: #777;
font-size: 1rem;
cursor: pointer;
padding: 4px;
border-radius: 4px;
flex-shrink: 0;
transition: color 0.2s, background 0.2s;
}
.kc-rect-row .kc-rect-remove-btn:hover {
color: var(--danger-color);
background: rgba(244, 67, 54, 0.1);
}
.kc-rect-labels {
display: flex;
gap: 6px;
padding: 0 8px;
margin-bottom: 4px;
font-size: 0.7rem;
color: var(--text-secondary);
font-weight: 600;
}
.kc-rect-labels span:first-child {
flex: 2;
}
.kc-rect-labels span {
flex: 1;
text-align: center;
}
.kc-rect-labels span:last-child {
width: 28px;
flex: 0 0 28px;
}
.kc-add-rect-btn {
width: 100%;
font-size: 0.85rem;
padding: 6px 12px;
}
.kc-rect-empty {
text-align: center;
color: var(--text-secondary);
font-size: 0.85rem;
padding: 12px;
font-style: italic;
}
.kc-color-swatches {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-bottom: 8px;
}
.kc-swatch {
display: flex;
flex-direction: column;
align-items: center;
gap: 3px;
}
.kc-swatch-color {
width: 32px;
height: 32px;
border-radius: 6px;
border: 2px solid var(--border-color);
transition: background-color 0.3s;
}
.kc-swatch-label {
font-size: 0.6rem;
color: var(--text-secondary);
max-width: 40px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: center;
}
.kc-no-colors {
color: var(--text-secondary);
font-size: 0.8rem;
font-style: italic;
padding: 4px 0;
}