-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Design changes: * no longer uppercase * no longer bold * remove 1px extra letter spacing * increase font size to 19px * change colours to use lighter background colours These changes are to improve the accessibility and readability of the tag text, and to make the tags look less like clickable buttons.
- Loading branch information
1 parent
839adc0
commit 976535e
Showing
6 changed files
with
77 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 51 additions & 27 deletions
78
packages/govuk-frontend/src/govuk/components/tag/_index.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,94 @@ | ||
@include govuk-exports("govuk/component/tag") { | ||
.govuk-tag { | ||
@include govuk-font($size: 16, $weight: bold, $line-height: 1); | ||
@include govuk-font($size: 19); | ||
|
||
display: inline-block; | ||
|
||
padding-top: 5px; | ||
// These negative margins make sure that the tag component doesn’t increase the | ||
// size of its container. Otherwise, for example, a table row containing a tag | ||
// will be taller than one containing plain text. | ||
// | ||
// The negative margin added to the top and bottom matches the extra padding added. | ||
margin-top: -2px; | ||
margin-bottom: -3px; | ||
|
||
padding-top: 2px; | ||
padding-right: 8px; | ||
padding-bottom: 4px; | ||
padding-bottom: 3px; | ||
padding-left: 8px; | ||
|
||
// When a user customises their colours often the background is removed, | ||
// by adding a outline we ensure that the tag component still keeps it's meaning. | ||
// https://accessibility.blog.gov.uk/2017/03/27/how-users-change-colours-on-websites/ | ||
outline: 2px solid transparent; | ||
outline-offset: -2px; | ||
|
||
color: govuk-colour("white"); | ||
background-color: govuk-colour("blue"); | ||
letter-spacing: 1px; | ||
color: govuk-shade(govuk-colour("blue"), 60%); | ||
background-color: govuk-tint(govuk-colour("blue"), 70%); | ||
|
||
text-decoration: none; | ||
text-transform: uppercase; | ||
|
||
// When forced colour mode is active, for example to provide high contrast, | ||
// the background colour of the tag is the same as the rest of the page. To ensure | ||
// that the tag is perceived as separate from any surround text, it is made bold. | ||
// | ||
// Transparent outlines are no longer added, as they make the Tag look indistinguishable | ||
// from a button – but the tag is not interactive in the same way. | ||
@media screen and (forced-colors: active) { | ||
font-weight: bold; | ||
} | ||
} | ||
|
||
// Previously the whole tag was transformed to UPPERCASE. We’ve since decided to switch | ||
// to title case to improve readability. The first letter is uppercased to ease the transition, | ||
// as the text may be all lowercase within the HTML itself. | ||
// | ||
// 'capitalize' is used instead of 'uppercase' as a workaround for a spacing bug in Firefox. | ||
.govuk-tag::first-letter { | ||
text-transform: capitalize; | ||
} | ||
|
||
.govuk-tag--grey { | ||
color: govuk-shade(govuk-colour("dark-grey"), 30%); | ||
background: govuk-tint(govuk-colour("dark-grey"), 90%); | ||
color: govuk-shade(govuk-colour("dark-grey"), 50%); | ||
background-color: govuk-tint(govuk-colour("dark-grey"), 85%); | ||
} | ||
|
||
.govuk-tag--purple { | ||
color: govuk-shade(govuk-colour("purple"), 20%); | ||
background: govuk-tint(govuk-colour("purple"), 80%); | ||
color: govuk-shade(govuk-colour("bright-purple"), 50%); | ||
background-color: govuk-tint(govuk-colour("bright-purple"), 85%); | ||
} | ||
|
||
.govuk-tag--turquoise { | ||
color: govuk-shade(govuk-colour("turquoise"), 60%); | ||
background: govuk-tint(govuk-colour("turquoise"), 70%); | ||
background-color: govuk-tint(govuk-colour("turquoise"), 80%); | ||
} | ||
|
||
.govuk-tag--blue { | ||
color: govuk-shade(govuk-colour("blue"), 30%); | ||
background: govuk-tint(govuk-colour("blue"), 80%); | ||
color: govuk-shade(govuk-colour("blue"), 60%); | ||
background-color: govuk-tint(govuk-colour("blue"), 70%); | ||
} | ||
|
||
.govuk-tag--light-blue { | ||
color: govuk-shade(govuk-colour("blue"), 60%); | ||
background-color: govuk-tint(govuk-colour("blue"), 90%); | ||
} | ||
|
||
.govuk-tag--yellow { | ||
color: govuk-shade(govuk-colour("yellow"), 65%); | ||
background: govuk-tint(govuk-colour("yellow"), 75%); | ||
background-color: govuk-tint(govuk-colour("yellow"), 75%); | ||
} | ||
|
||
.govuk-tag--orange { | ||
color: govuk-shade(govuk-colour("orange"), 55%); | ||
background: govuk-tint(govuk-colour("orange"), 70%); | ||
background-color: govuk-tint(govuk-colour("orange"), 70%); | ||
} | ||
|
||
.govuk-tag--red { | ||
color: govuk-shade(govuk-colour("red"), 30%); | ||
background: govuk-tint(govuk-colour("red"), 80%); | ||
color: govuk-shade(govuk-colour("red"), 80%); | ||
background-color: govuk-tint(govuk-colour("red"), 75%); | ||
} | ||
|
||
.govuk-tag--pink { | ||
color: govuk-shade(govuk-colour("pink"), 40%); | ||
background: govuk-tint(govuk-colour("pink"), 80%); | ||
color: govuk-shade(govuk-colour("pink"), 50%); | ||
background-color: govuk-tint(govuk-colour("pink"), 85%); | ||
} | ||
|
||
.govuk-tag--green { | ||
color: govuk-shade(govuk-colour("green"), 20%); | ||
background: govuk-tint(govuk-colour("green"), 80%); | ||
background-color: govuk-tint(govuk-colour("green"), 80%); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters