Skip to content
This repository was archived by the owner on Mar 6, 2025. It is now read-only.

Commit 46312b5

Browse files
author
John Earle
committed
add colors from new palette
1 parent 7d181ef commit 46312b5

File tree

8 files changed

+355
-96
lines changed

8 files changed

+355
-96
lines changed

README.md

+13-20
Original file line numberDiff line numberDiff line change
@@ -6,63 +6,56 @@ Winter '21 version of the Salesforce Lightning Design System
66

77
## About Sketch Assistants
88

9-
First time using a Sketch Assistant? Read Sketch's help documentation [here](https://www.sketch.com/docs/assistants/).
9+
First time using a Sketch Assistant?
10+
[Read Sketch's help documentation](https://www.sketch.com/docs/assistants/).
1011

1112
## Versions
1213

1314
Make sure you are validating against the correct SLDS release.
1415

15-
| Linter Version | SLDS Release | URL (Copy and paste in browser to download.) |
16-
| -------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
17-
| 1.0.5 | Winter '21 | sketch://add-assistant?url=<br/>h<span>tt</span>ps://registry.npmjs.org/lightning-design-system-linter/-/lightning-design-system-linter-1.0.5.tgz |
16+
| Linter Version | SLDS Release | URL (Copy and paste in browser to download.) |
17+
| -------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
18+
| 1.0.5 | Winter '21 Only | sketch://add-assistant?url=<br/>h<span>tt</span>ps://registry.npmjs.org/lightning-design-system-linter/-/lightning-design-system-linter-1.0.5.tgz |
1819

1920
## Linter Rules
2021

2122
<h3 id='lightning-design-system-linter/fill-color'>Fill Color</h3>
2223

2324
Fill colors should match SLDS background or generic color token values.
2425

25-
- See available **background color** tokens
26-
[here](https://www.lightningdesignsystem.com/design-tokens/#category-background-color).
27-
- See available **generic color** tokens
28-
[here](https://www.lightningdesignsystem.com/design-tokens/#category-color).
26+
- [See available **background color** tokens.](https://www.lightningdesignsystem.com/design-tokens/#category-background-color)
27+
- [See available **generic color** tokens.](https://www.lightningdesignsystem.com/design-tokens/#category-color)
2928

3029
---
3130

3231
<h3 id='lightning-design-system-linter/border-color'>Border Color</h3>
3332

3433
Border colors should match SLDS border or generic color token values.
3534

36-
- See available **border color** tokens
37-
[here](https://www.lightningdesignsystem.com/design-tokens/#category-border-color).
38-
- See available **generic color** tokens
39-
[here](https://www.lightningdesignsystem.com/design-tokens/#category-color).
35+
- [See available **border color** tokens.](https://www.lightningdesignsystem.com/design-tokens/#category-border-color)
36+
- [See available **generic color** tokens.](https://www.lightningdesignsystem.com/design-tokens/#category-color)
4037

4138
---
4239

4340
<h3 id='lightning-design-system-linter/text-color'>Text Color</h3>
4441

4542
Text colors should match SLDS text or generic color token values.
4643

47-
- See available **text color** tokens
48-
[here](https://www.lightningdesignsystem.com/design-tokens/#category-text-color).
49-
- See available **generic color** tokens
50-
[here](https://www.lightningdesignsystem.com/design-tokens/#category-color).
44+
- [See available **text color** tokens.](https://www.lightningdesignsystem.com/design-tokens/#category-text-color)
45+
- [See available **generic color** tokens.](https://www.lightningdesignsystem.com/design-tokens/#category-color)
5146

5247
---
5348

5449
<h3 id='lightning-design-system-linter/text-size'>Text Size</h3>
5550

5651
Text sizes should match SLDS font size token values.
5752

58-
- See available **font size** tokens
59-
[here](https://www.lightningdesignsystem.com/design-tokens/#category-font-size).
53+
- [See available **font size** tokens.](https://www.lightningdesignsystem.com/design-tokens/#category-font-size)
6054

6155
---
6256

6357
<h3 id='lightning-design-system-linter/font'>Font Family</h3>
6458

6559
All text should use the Salesforce Sans font family.
6660

67-
- Download Salesforce Sans from
68-
[Github](https://github.com/salesforce-ux/design-system/tree/master/assets/fonts).
61+
- [Download Salesforce Sans from Github.](https://github.com/salesforce-ux/design-system/tree/master/assets/fonts)

package-lock.json

+21-14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "lightning-design-system-linter",
33
"homepage": "https://github.com/salesforce-ux/lightning-design-system-linter",
4-
"version": "1.0.5",
4+
"version": "1.1.0",
55
"main": "dist/index.js",
66
"sketch": "dist/sketch.js",
77
"license": "MIT",
88
"sketch-assistant": {
99
"title": "Lightning Design System Linter",
10-
"description": "[Winter '21 release]\nA Sketch Assistant for the Salesforce Lightning Design System.",
10+
"description": "A Sketch Assistant for the Salesforce Lightning Design System.",
1111
"icon": "https://user-images.githubusercontent.com/7698220/91777276-456a9c00-eba4-11ea-92bd-e2b1315ab270.png"
1212
},
1313
"author": {
@@ -46,6 +46,8 @@
4646
"webpack-cli": "3.3.12"
4747
},
4848
"dependencies": {
49-
"@sketch-hq/sketch-assistant-types": "6.0.0"
49+
"@sketch-hq/sketch-assistant-types": "6.0.0",
50+
"@types/parse-color": "^1.0.0",
51+
"parse-color": "^1.0.0"
5052
}
5153
}

src/__tests__/index.test.ts

+26-18
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,25 @@ import * as primitiveTokens from '../design-tokens/primitive.json'
66
import * as actionIconTokens from '../design-tokens/bg-actions.json'
77
import * as standardIconTokens from '../design-tokens/bg-standard.json'
88
import * as customIconTokens from '../design-tokens/bg-custom.json'
9+
import * as newPaletteValues from '../design-tokens/new-palette.json'
910

1011
import Assistant from '..'
1112

13+
const newPaletteLength = Object.keys(newPaletteValues).length - 1
14+
1215
test('border-color', async () => {
1316
const { violations, ruleErrors } = await testAssistant(
1417
resolve(__dirname, './test.sketch'),
1518
Assistant,
1619
)
17-
const borderColorViolations = violations.find(
20+
const borderColorViolations = violations.filter(
1821
(v) => v.ruleName === 'lightning-design-system-linter/border-color',
19-
)?.objects
22+
)
2023

2124
expect(borderColorViolations?.length).toBe(1)
22-
expect(borderColorViolations ? borderColorViolations[0].name : null).toBe('Bad Rectangle')
25+
expect(borderColorViolations ? borderColorViolations[0].objects[0].name : null).toBe(
26+
'Bad Rectangle',
27+
)
2328
expect(ruleErrors).toHaveLength(0)
2429
})
2530

@@ -28,12 +33,13 @@ test('fill-color', async () => {
2833
resolve(__dirname, './test.sketch'),
2934
Assistant,
3035
)
31-
const fillColorViolations = violations.find(
36+
37+
const fillColorViolations = violations.filter(
3238
(v) => v.ruleName === 'lightning-design-system-linter/fill-color',
33-
)?.objects
39+
)
3440

3541
expect(fillColorViolations?.length).toBe(1)
36-
expect(fillColorViolations ? fillColorViolations[0].name : null).toBe('Bad Rectangle')
42+
expect(fillColorViolations ? fillColorViolations[0].objects[0].name : null).toBe('Bad Rectangle')
3743
expect(ruleErrors).toHaveLength(0)
3844
})
3945

@@ -42,12 +48,13 @@ test('text-color', async () => {
4248
resolve(__dirname, './test.sketch'),
4349
Assistant,
4450
)
45-
const textColorViolations = violations.find(
51+
const textColorViolations = violations.filter(
4652
(v) => v.ruleName === 'lightning-design-system-linter/text-color',
47-
)?.objects
53+
)
4854

4955
expect(textColorViolations?.length).toBe(1)
50-
expect(textColorViolations ? textColorViolations[0].name : null).toBe('Bad Text')
56+
57+
expect(textColorViolations ? textColorViolations[0].objects[0].name : null).toBe('Bad Text')
5158
expect(ruleErrors).toHaveLength(0)
5259
})
5360

@@ -56,12 +63,12 @@ test('text-font', async () => {
5663
resolve(__dirname, './test.sketch'),
5764
Assistant,
5865
)
59-
const fontFamilyViolations = violations.find(
66+
const fontFamilyViolations = violations.filter(
6067
(v) => v.ruleName === 'lightning-design-system-linter/font',
61-
)?.objects
68+
)
6269

6370
expect(fontFamilyViolations?.length).toBe(1)
64-
expect(fontFamilyViolations ? fontFamilyViolations[0].name : null).toBe('Bad Text')
71+
expect(fontFamilyViolations ? fontFamilyViolations[0].objects[0].name : null).toBe('Bad Text')
6572
expect(ruleErrors).toHaveLength(0)
6673
})
6774

@@ -70,12 +77,12 @@ test('text-size', async () => {
7077
resolve(__dirname, './test.sketch'),
7178
Assistant,
7279
)
73-
const fontSizeViolations = violations.find(
80+
const fontSizeViolations = violations.filter(
7481
(v) => v.ruleName === 'lightning-design-system-linter/text-size',
75-
)?.objects
82+
)
7683

7784
expect(fontSizeViolations?.length).toBe(1)
78-
expect(fontSizeViolations ? fontSizeViolations[0].name : null).toBe('Bad Text')
85+
expect(fontSizeViolations ? fontSizeViolations[0].objects[0].name : null).toBe('Bad Text')
7986
expect(ruleErrors).toHaveLength(0)
8087
})
8188

@@ -86,21 +93,22 @@ test('getBackgroundColors', async () => {
8693
.concat(standardIconTokens.properties)
8794
.concat(customIconTokens.properties)
8895

89-
expect(getBackgroundColors()).toHaveLength(tokens.length)
96+
expect(getBackgroundColors()).toHaveLength(tokens.length + newPaletteLength)
9097
})
9198

9299
test('getBorderColors', async () => {
93100
const tokens = primitiveTokens.properties.filter(
94101
(p) => p.category === 'border-color' || p.category === 'color',
95102
)
96-
expect(getBorderColors()).toHaveLength(tokens.length)
103+
expect(getBorderColors()).toHaveLength(tokens.length + newPaletteLength)
97104
})
98105

99106
test('getTextColors', async () => {
100107
const tokens = primitiveTokens.properties.filter(
101108
(p) => p.category === 'text-color' || p.category === 'color',
102109
)
103-
expect(getTextColors()).toHaveLength(tokens.length)
110+
111+
expect(getTextColors()).toHaveLength(tokens.length + newPaletteLength)
104112
})
105113

106114
test('getFontSizes', async () => {

src/__tests__/test.sketch

241 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)