Skip to content

Commit 4889bba

Browse files
Use nested CSS
1 parent a76158b commit 4889bba

File tree

1 file changed

+49
-59
lines changed

1 file changed

+49
-59
lines changed

schemascii_example.css

Lines changed: 49 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,59 @@
11
svg.schemascii {
22
background: black;
3-
}
4-
5-
svg.schemascii .wire polyline {
6-
stroke: var(--sch-color, blue);
7-
stroke-width: 2;
8-
stroke-linecap: round;
9-
stroke-linejoin: round;
10-
transition-duration: 0.2s;
11-
fill: transparent;
12-
}
13-
14-
svg.schemascii .wire circle {
15-
fill: var(--sch-color, blue);
16-
transition-duration: 0.2s;
17-
}
18-
19-
svg.schemascii :is(.wire, .component):hover {
20-
--sch-color: lime;
21-
}
22-
23-
svg.schemascii .component :is(polyline, path, line, polygon, rect, circle):not(.filled) {
24-
stroke: var(--sch-color, red);
25-
stroke-width: 2;
26-
stroke-linecap: round;
27-
transition-duration: 0.2s;
28-
fill: transparent;
29-
}
30-
31-
svg.schemascii .component :is(polyline, path, line, polygon, rect, circle).filled {
32-
fill: var(--sch-color, red);
33-
stroke: none;
34-
transition-duration: 0.2s;
35-
}
36-
37-
38-
svg.schemascii .component .plus :is(polyline, path, line) {
39-
stroke-width: 1;
40-
}
41-
42-
svg.schemascii .component polygon {
43-
fill: var(--sch-color, red);
44-
}
45-
46-
svg.schemascii .component text {
47-
fill: white;
48-
transition-duration: 0.2s;
49-
}
50-
51-
svg.schemascii .component:hover text {
52-
font-weight: bold;
53-
}
543

55-
svg.schemascii .component tspan:is(.cmp-value, .part-num) {
56-
opacity: 50%;
4+
& .wire polyline {
5+
stroke: var(--sch-color, blue);
6+
stroke-width: 2;
7+
stroke-linecap: round;
8+
stroke-linejoin: round;
9+
transition-duration: 0.2s;
10+
fill: transparent;
11+
}
12+
& .wire circle {
13+
fill: var(--sch-color, blue);
14+
transition-duration: 0.2s;
15+
}
16+
& :is(.wire, .component):hover {
17+
--sch-color: lime;
18+
}
19+
& .component :is(polyline, path, line, polygon, rect, circle):not(.filled) {
20+
stroke: var(--sch-color, red);
21+
stroke-width: 2;
22+
stroke-linecap: round;
23+
transition-duration: 0.2s;
24+
fill: transparent;
25+
}
26+
& .component :is(polyline, path, line, polygon, rect, circle).filled {
27+
fill: var(--sch-color, red);
28+
stroke: none;
29+
transition-duration: 0.2s;
30+
}
31+
& .component .plus :is(polyline, path, line) {
32+
stroke-width: 1;
33+
}
34+
& .component polygon {
35+
fill: var(--sch-color, red);
36+
}
37+
& .component text {
38+
fill: white;
39+
transition-duration: 0.2s;
40+
}
41+
& .component:hover text {
42+
font-weight: bold;
43+
}
44+
& .component tspan:is(.cmp-value, .part-num) {
45+
opacity: 50%;
46+
}
5747
}
5848

5949
@media all and (prefers-color-scheme: light) {
6050
svg.schemascii {
6151
background: white;
62-
}
63-
svg.schemascii .component text {
64-
fill: black;
65-
}
66-
svg.schemascii :is(.wire, .component):hover {
67-
--sch-color: lime;
52+
& .component text {
53+
fill: black;
54+
}
55+
& :is(.wire, .component):hover {
56+
--sch-color: lime;
57+
}
6858
}
6959
}

0 commit comments

Comments
 (0)