Skip to content

Commit

Permalink
Set component-level dark mode for Logs
Browse files Browse the repository at this point in the history
Update the Log component styles so it always uses dark mode regardless
of the theme selected for the rest of the application.

Also update the base colour used for links to meet minimum contrast
requirements for accessibility.
  • Loading branch information
AlanGreene committed Jun 2, 2021
1 parent 5af03e5 commit 6b059ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/components/src/components/Log/Log.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ limitations under the License.
*/

pre.tkn--log {
@include carbon--theme($carbon--theme--g90, true);

position: relative;
padding: 2rem 1.6rem 1.3rem 1.6rem;
font-family: ibm-plex-mono, monospace;
Expand All @@ -22,24 +24,22 @@ pre.tkn--log {

line-height: 0.95rem; // Update the react-window List itemSize if changing this
overflow: hidden;
background-color: $gray-90; // TODO: should this be $inverse-02 ?
color: $gray-10; // if so, then this should be $inverse-01
background-color: $ui-background;
color: $text-01;

word-break: normal;
word-wrap: normal;

.bx--skeleton__text {
// TODO: revisit when Carbon supports component-level themeing
// these should be using the $skeleton-01 and $skeleton-02 tokens
background-color: $gray-80;
background-color: $skeleton-01;

&::before {
background-color: $gray-70;
background-color: $skeleton-02;
}
}

a {
color: $inverse-link;
color: $link-01;
}

code {
Expand All @@ -56,18 +56,18 @@ pre.tkn--log {
.bx--copy-btn {
width: 2rem;
height: 2rem;
background-color: $gray-90; // TODO: $inverse-02 - see above
background-color: $ui-background;

&:hover {
background-color: $gray-80; // TODO: $inverse-hover-ui - see above
background-color: $hover-ui;
}

&:focus {
outline-color: white;
}

svg {
fill: $gray-10; // TODO: use theme token
fill: $icon-01;
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/scss/_carbon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,7 @@ $feature-flags: (
@import '~carbon-components/scss/components/inline-loading/inline-loading';
@import '~carbon-components/scss/components/ui-shell/ui-shell';
@import '~carbon-components/scss/components/list/list';

a {
color: $link-01;
}

0 comments on commit 6b059ec

Please sign in to comment.