Skip to content

Commit

Permalink
update dark and light green scales
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasoppermann committed Oct 8, 2024
1 parent 028ad8e commit 9e10b71
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 49 deletions.
64 changes: 43 additions & 21 deletions .github/workflows/a11y-contrast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ jobs:
const results = require('./color-contrast-check.json');
const faildChecks = results.reduce((acc, {failingContrast}) => acc + failingContrast, 0);
// prepare outputs for all failed themes
const failedResults = results.filter(themeResults => themeResults.failingContrast > 0).map(({theme, failingContrast, markdownTable}) => ({
title: `# ❌ \`${theme}\`: ${failingContrast} checks failed`,
title: `# ❌ \`${theme}\`: ${failingContrast} checks failed`,
body: `${markdownTable}`
identifier: `<!-- contrast check --><!-- Theme: ${theme} -->`
}))
// prepare summary body
Expand Down Expand Up @@ -101,6 +103,7 @@ jobs:
with:
script: |
const results = ${{ steps.check-results.outputs.failedResults }}
const WORKFLOW_SUMMARY_URL = `https://github.com/${{env.GITHUB_REPOSITORY}}/actions/runs/${{env.GITHUB_RUN_ID}}`
// get comments
Expand All @@ -110,30 +113,47 @@ jobs:
repo: context.repo.repo
});
for (const {title, body} of results) {
// get token issue
const tokenCheckComment = comments.filter(comment => comment.body.includes(title));
const outputBody = `${title}\n\n${body}\n\n<a href="${WORKFLOW_SUMMARY_URL}">→ Details</a>`
// get comments of token issues
let currentComments = comments.filter(comment => possibleTitles.some(titleStart => comment.body.includes(titleStart)));
// if token issue exists, update it
if(tokenCheckComment.length > 0) {
await github.rest.issues.updateComment({
comment_id: tokenCheckComment[0].id,
// get token issue
const tokenCheckComment = comments.filter(comment => comment.body.includes("<!-- contrast check -->"));
// if token issue exists, update it
if(tokenCheckComment.length > 0) {
for (const comment of tokenCheckComment) {
await github.rest.issues.deleteComment({
comment_id: comment.id,
owner: context.repo.owner,
repo: context.repo.repo,
body: outputBody
})
}
}
for (const {title, body, indentifier} of results) {
// get token issue
const outputBody = `${title}\n\n${body}\n\n<a href="${WORKFLOW_SUMMARY_URL}">→ Details</a>${indentifier}`
// if token issue does not exist, create it
else {
await github.rest.issues.createComment({
issue_number: context.issue.number,
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: outputBody
})
}
// if token issue exists, update it
if(currentComments.length > 0) {
await currentComments.map(comment => {
console.log('deleting comment', comment.id, comment)
github.rest.issues.deleteComment({
comment_id: comment.id,
owner: context.repo.owner,
repo: context.repo.repo,
body: outputBody
})
}
})
}
Fail_action_on_contrast_failing:
Expand Down Expand Up @@ -165,15 +185,17 @@ jobs:
});
// get token issue
const tokenCheckComment = comments.filter(comment => comment.body.includes('## Design Token Contrast Check'));
const tokenCheckComment = comments.filter(comment => comment.body.includes("<!-- contrast check -->"));
// if token issue exists, update it
if(tokenCheckComment.length > 0) {
await github.rest.issues.deleteComment({
comment_id: tokenCheckComment[0].id,
owner: context.repo.owner,
repo: context.repo.repo,
})
for (const comment of tokenCheckComment) {
await github.rest.issues.deleteComment({
comment_id: comment.id,
owner: context.repo.owner,
repo: context.repo.repo,
})
}
}
// remove summary
Expand Down
20 changes: 10 additions & 10 deletions src/tokens/base/color/dark/dark.json5
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
},
green: {
'0': {
$value: '#aff5b4',
$value: '#70e691',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -273,7 +273,7 @@
},
},
'1': {
$value: '#7ee787',
$value: '#1edc5a',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -282,7 +282,7 @@
},
},
'2': {
$value: '#56d364',
$value: '#13c351',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -291,7 +291,7 @@
},
},
'3': {
$value: '#3fb950',
$value: '#0cb64d',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -300,7 +300,7 @@
},
},
'4': {
$value: '#2ea043',
$value: '#048f3e',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -309,7 +309,7 @@
},
},
'5': {
$value: '#238636',
$value: '#00873D',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -318,7 +318,7 @@
},
},
'6': {
$value: '#196c2e',
$value: '#005c2c',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -327,7 +327,7 @@
},
},
'7': {
$value: '#0f5323',
$value: '#004725',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -336,7 +336,7 @@
},
},
'8': {
$value: '#033a16',
$value: '#00331c',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -345,7 +345,7 @@
},
},
'9': {
$value: '#04260f',
$value: '#002918',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand Down
20 changes: 10 additions & 10 deletions src/tokens/base/color/light/light.json5
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
},
green: {
'0': {
$value: '#dafbe1',
$value: '#cbf6d7',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -273,7 +273,7 @@
},
},
'1': {
$value: '#aceebb',
$value: '#8aefaa',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -282,7 +282,7 @@
},
},
'2': {
$value: '#6fdd8b',
$value: '#16da5a',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -291,7 +291,7 @@
},
},
'3': {
$value: '#4ac26b',
$value: '#0cc051',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -300,7 +300,7 @@
},
},
'4': {
$value: '#2da44e',
$value: '#05a347',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -309,7 +309,7 @@
},
},
'5': {
$value: '#1a7f37',
$value: '#00873D',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -318,7 +318,7 @@
},
},
'6': {
$value: '#116329',
$value: '#007036',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -327,7 +327,7 @@
},
},
'7': {
$value: '#044f1e',
$value: '#006132',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -336,7 +336,7 @@
},
},
'8': {
$value: '#003d16',
$value: '#004d2a',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -345,7 +345,7 @@
},
},
'9': {
$value: '#002d11',
$value: '#003821',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand Down
4 changes: 2 additions & 2 deletions src/tokens/functional/color/light/patterns-light.json5
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@
scopes: ['bgColor'],
},
},
}
},
},
},
button: {
Expand Down Expand Up @@ -2089,7 +2089,7 @@
underlineNav: {
borderColor: {
active: {
$value: '{base.color.coral.3}',
$value: '#FD794F',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand Down
8 changes: 2 additions & 6 deletions src/tokens/functional/color/light/primitives-light.json5
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
},
},
success: {
$value: '{base.color.green.5}',
$value: '{base.color.green.6}',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand Down Expand Up @@ -475,7 +475,7 @@
},
},
emphasis: {
$value: '{base.color.green.4}',
$value: '{base.color.green.5}',
$type: 'color',
$extensions: {
'org.primer.figma': {
Expand All @@ -488,10 +488,6 @@
},
},
},
mix: {
color: '{base.color.green.5}',
weight: 0.75,
},
},
},
open: {
Expand Down

0 comments on commit 9e10b71

Please sign in to comment.