Files
ledgrab/server/src/wled_controller/static/css/patterns.css
T
alexei.dolgolyov 3e6760f726
Lint & Test / test (push) Successful in 1m26s
refactor: key colors targets → CSS source type, HA target improvements
Key Colors refactor:
- New `key_colors` CSS source type with inline rectangles
- KeyColorsColorStripStream: extracts N colors from screen regions
- CSS editor: EntitySelect for picture source, IconSelect for color mode
- Configure Regions button on card opens pattern canvas editor
- Live WS preview at 5 FPS with rectangle overlay + color swatches
- Removed KC target type, pattern template entity, and related API routes
- Removed KC/pattern template sections from Targets tab

HA light target improvements:
- Update rate, transition, mappings, brightness VS now editable via PUT
- Card crosslinks for HA source, CSS source, brightness VS
- HA connection status icon, text metrics (Hz, uptime)
- Brightness value source selector in editor
2026-03-28 15:28:22 +03:00

391 lines
7.2 KiB
CSS

/* Static image stream styles */
.image-preview-container {
text-align: center;
margin: 12px 0;
padding: 12px;
background: var(--bg-secondary);
border-radius: 8px;
border: 1px solid var(--border-color);
}
.stream-image-preview {
max-width: 100%;
max-height: 200px;
border-radius: 4px;
border: 1px solid var(--border-color);
}
.stream-image-info {
font-size: 0.75rem;
color: var(--text-muted);
margin-top: 6px;
}
.validation-status {
font-size: 0.8rem;
margin-top: 4px;
padding: 4px 8px;
border-radius: 4px;
}
.validation-status.success {
color: var(--primary-color);
}
.validation-status.error {
color: var(--danger-color);
}
.validation-status.loading {
color: var(--text-muted);
}
.stream-card-props {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
gap: 6px;
margin-bottom: 8px;
}
.stream-card-prop {
display: inline-block;
font-size: 0.75rem;
color: var(--text-secondary);
background: var(--border-color);
padding: 2px 8px;
border-radius: 10px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 180px;
vertical-align: middle;
}
.stream-card-prop .icon {
color: var(--primary-text-color);
}
.stream-card-prop-full {
max-width: 100%;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 0.7rem;
}
.stream-card-link {
cursor: pointer;
text-decoration: none;
transition: background 0.2s, color 0.2s;
}
.stream-card-link:hover {
background: var(--primary-color);
color: var(--primary-contrast);
}
.stream-card-link:hover .icon {
color: var(--primary-contrast);
}
@keyframes cardHighlight {
0%, 100% { box-shadow: none; }
25%, 75% { box-shadow: 0 0 0 3px var(--primary-color), 0 0 20px rgba(var(--primary-rgb, 59, 130, 246), 0.3); }
}
.card-highlight,
.template-card.card-highlight {
animation: cardHighlight 2s ease-in-out;
position: relative;
z-index: 11;
}
/* Dim overlay behind highlighted card */
.nav-dim-overlay {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.4);
z-index: 10;
pointer-events: none;
opacity: 0;
transition: opacity 0.3s ease-in-out;
}
.nav-dim-overlay.active {
opacity: 1;
}
/* 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: var(--text-muted);
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;
}
/* Pattern Template Visual Editor */
.pattern-canvas-container {
position: relative;
border-radius: 8px;
overflow: hidden;
background: var(--bg-color);
border: 1px solid var(--border-color);
margin-bottom: 12px;
resize: both;
width: 820px;
min-width: 400px;
max-width: 100%;
min-height: 200px;
height: 450px;
max-height: calc(100vh - 400px);
}
#pattern-canvas {
width: 100%;
height: 100%;
display: block;
cursor: default;
}
.pattern-canvas-toolbar {
display: flex;
gap: 2px;
padding: 4px;
align-items: center;
background: var(--bg-secondary);
border-radius: 6px;
margin-top: 4px;
}
.pattern-canvas-toolbar .btn {
flex: 0 0 auto;
min-width: 32px;
width: 32px;
height: 32px;
padding: 0;
font-size: 1rem;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
}
.pattern-bg-row {
display: flex;
gap: 0.5rem;
align-items: center;
margin-bottom: 8px;
}
.pattern-bg-row select {
flex: 1;
}
.pattern-capture-btn {
flex: 0 0 auto;
min-width: 36px !important;
width: 36px;
height: 36px;
padding: 0 !important;
font-size: 1.1rem;
line-height: 36px;
text-align: center;
}
.pattern-rect-list {
display: flex;
flex-direction: column;
gap: 6px;
margin-top: 8px;
max-height: 200px;
overflow-y: auto;
}
.pattern-rect-row {
display: flex;
align-items: center;
gap: 6px;
padding: 6px 8px;
background: var(--bg-color);
border: 1px solid var(--border-color);
border-radius: 6px;
font-size: 0.85rem;
cursor: pointer;
transition: border-color 0.15s;
}
.pattern-rect-row.selected {
border-color: var(--primary-color);
background: rgba(76, 175, 80, 0.08);
}
.pattern-rect-row input[type="text"] {
flex: 2;
min-width: 0;
padding: 4px 6px;
font-size: 0.8rem;
}
.pattern-rect-row input[type="number"] {
flex: 1;
min-width: 0;
width: 55px;
padding: 4px 6px;
font-size: 0.8rem;
}
.pattern-rect-row .pattern-rect-remove-btn {
background: none;
border: none;
color: var(--text-muted);
cursor: pointer;
padding: 2px 4px;
border-radius: 4px;
flex-shrink: 0;
transition: color 0.2s, background 0.2s;
}
.pattern-rect-row .pattern-rect-remove-btn .icon {
width: 14px;
height: 14px;
}
.pattern-rect-row .pattern-rect-remove-btn:hover {
color: var(--danger-color);
background: rgba(244, 67, 54, 0.1);
}
.pattern-rect-labels {
display: flex;
gap: 6px;
padding: 0 8px;
margin-bottom: 2px;
font-size: 0.7rem;
color: var(--text-secondary);
font-weight: 600;
}
.pattern-rect-labels span:first-child {
flex: 2;
}
.pattern-rect-labels span {
flex: 1;
text-align: center;
}
.pattern-rect-labels span:last-child {
width: 24px;
flex: 0 0 24px;
}