Skip to content

Commit eb95931

Browse files
authored
Merge pull request #826 from lit/svg-tutorial
[tutorials] svg tutorial updates
2 parents 41d23ea + f91b2ef commit eb95931

File tree

4 files changed

+13
-19
lines changed
  • packages/lit-dev-content

4 files changed

+13
-19
lines changed

packages/lit-dev-content/samples/tutorials/svg-templates/00/before/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@
7676
<input value="T">
7777
<input type="range" min="2" max="29" value="8">
7878
<input type="range" min="0" max="360" value="0">
79-
<input type="color" value="#000000">
8079
<input type="color" value="#7acbf1">
80+
<input type="color" value="#e3a7b2">
8181
<input type="color" value="#ffffff">
8282
</div>
8383
</body>

packages/lit-dev-content/site/tutorials/content/svg-templates/03.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const helloTile = svg`
3737
clip-path="url(#rect-clip)"
3838
width="300"
3939
height="300"
40-
fill="#000">
40+
fill="#000000">
4141
</rect>
4242
```
4343

packages/lit-dev-content/site/tutorials/content/svg-templates/04.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ render() {
9292
return html`
9393
<svg height="100%" width="100%">
9494
...
95-
<rect height="100%" width="100%" fill="#fff"></rect>
95+
<rect height="100%" width="100%" fill="#ffffff"></rect>
9696
<rect height="100%" width="100%" fill="url(#repeat-pattern)"></rect>
9797
</svg>
9898
`;

packages/lit-dev-content/site/tutorials/content/svg-templates/05.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,13 @@ CSS applies attributes to HTML.
1212
However, only [SVG presentation attributes](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/Presentation)
1313
can be applied to SVG through CSS.
1414

15-
In the following example, all `<rect>` elements will be as wide as
16-
their parent element while elements using the class `background` will
15+
In the following example, all elements using the class `background` will
1716
have a black fill.
1817

19-
2018
```ts
2119
const helloSvgCss = css`
22-
rect {
23-
width: 100%;
24-
}
25-
2620
.background {
27-
fill: #000;
21+
fill: #000000;
2822
}
2923
`;
3024
```
@@ -44,7 +38,7 @@ HTML counterpart.
4438
```ts
4539
const helloCssCustomProperties = css`
4640
.background {
47-
fill: var(--background-color, #ff8800);
41+
fill: var(--background-color, #000000);
4842
}
4943
`;
5044
```
@@ -68,7 +62,7 @@ const svgCSS = css`
6862
}
6963
7064
text {
71-
fill: #fff;
65+
fill: #ffffff;
7266
dominant-baseline: hanging;
7367
font-family: monospace;
7468
font-size: 24px;
@@ -90,14 +84,14 @@ representing the required theme.
9084
```ts
9185
const themeCSS = css`
9286
.background {
93-
fill: var(--background-color, #000);
87+
fill: var(--background-color, #000000);
9488
}
9589
9690
text {
97-
fill: var(--font-color, #fff);
91+
fill: var(--font-color, #ffffff);
9892
font-size: var(--font-size, 26px);
9993
stroke-width: var(--stroke-width, 1.2px);
100-
stroke: var(--stroke-color, #eee);
94+
stroke: var(--stroke-color, #eeeeee);
10195
}
10296
`;
10397
```
@@ -147,11 +141,11 @@ Finally add CSS custom properties to the styles in `index.html` to theme
147141

148142
```css
149143
:root {
150-
--background-color: #000;
151-
--font-color: #fff;
144+
--background-color: #000000;
145+
--font-color: #ffffff;
152146
--font-size: 26px;
153147
--stroke-width: 1.2px;
154-
--stroke-color: #7acbf1;
148+
--stroke-color: #eeeeee;
155149

156150
font-family: 'Open Sans', sans-serif;
157151
font-size: 1.5em;

0 commit comments

Comments
 (0)