Skip to content

Commit

Permalink
Merge pull request #1087 from rust-lang/dark-mode
Browse files Browse the repository at this point in the history
Tweak some dark-mode colors to improve contrast a smidge
  • Loading branch information
shepmaster authored Sep 24, 2024
2 parents 2115824 + 5e1f839 commit 748fd36
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 26 deletions.
9 changes: 4 additions & 5 deletions ui/frontend/ButtonSet.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ $radius: 4px;
color: var(--button-secondary-color-light);
}

&:visited {
color: var(--button-secondary-color);
}

&:hover:enabled {
background: inherit;
background-color: var(--button-secondary-border-color);
Expand Down Expand Up @@ -118,8 +122,3 @@ $radius: 4px;
aspect-ratio: 1/1;
justify-items: center;
}

a.iconLink svg,
a.iconLink:visited svg {
fill: var(--font-color) !important;
}
2 changes: 1 addition & 1 deletion ui/frontend/ButtonSet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ IconButton.displayName = 'IconButton';

export const IconLink = React.forwardRef<HTMLAnchorElement, LinkProps>(
({ children, ...props }, ref) => (
<Link ref={ref} className={`${styles.icon} ${styles.iconLink}`} {...props}>
<Link ref={ref} className={styles.icon} {...props}>
{children}
</Link>
),
Expand Down
2 changes: 1 addition & 1 deletion ui/frontend/Help.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
background-color: var(--background-color-high-contrast);
padding: 1em;
max-width: 800px;
line-height: 1.5;
line-height: 1.25;
}

.code {
Expand Down
9 changes: 4 additions & 5 deletions ui/frontend/Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';


import * as styles from './Icon.module.css';

/* eslint-disable max-len */
Expand All @@ -24,7 +23,7 @@ export const ExpandableIcon = () => (

// M.D. 'more_horiz'
export const MoreOptionsIcon = () => (
<svg className={styles.icon} height="18" viewBox="0 0 24 24" width="18" opacity="0.5" xmlns="http://www.w3.org/2000/svg">
<svg className={styles.icon} height="18" viewBox="0 0 24 24" width="18" xmlns="http://www.w3.org/2000/svg">
<path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" />
</svg>
);
Expand All @@ -38,20 +37,20 @@ export const MoreOptionsActiveIcon = () => (

// M.D. 'settings',
export const ConfigIcon = () => (
<svg className={styles.icon} height="15" viewBox="0 0 24 24" width="15" opacity="0.5" xmlns="http://www.w3.org/2000/svg">
<svg className={styles.icon} height="15" viewBox="0 0 24 24" width="15" xmlns="http://www.w3.org/2000/svg">
<path d="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z" />
</svg>
);

// M.D. 'help_outline'
export const HelpIcon = () => (
<svg className={styles.icon} height="18" viewBox="0 0 24 24" width="18" opacity="0.5" xmlns="http://www.w3.org/2000/svg">
<svg className={styles.icon} height="18" viewBox="0 0 24 24" width="18" xmlns="http://www.w3.org/2000/svg">
<path d="M11 18h2v-2h-2v2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4z" />
</svg>
);

export const CheckmarkIcon = () => (
<svg className={styles.icon} height="18" viewBox="2 2 22 22" width="18" opacity="0.5" xmlns="http://www.w3.org/2000/svg">
<svg className={styles.icon} height="18" viewBox="2 2 22 22" width="18" xmlns="http://www.w3.org/2000/svg">
<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" />
</svg>
);
Expand Down
2 changes: 1 addition & 1 deletion ui/frontend/Output.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
border: var(--border);
border-right: none;
background-color: var(--output-background-tab);
line-height: 1.5em;
line-height: 1.5;

&:last-of-type {
border-right: var(--border);
Expand Down
42 changes: 30 additions & 12 deletions ui/frontend/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -103,47 +103,62 @@
/* Output tabs */
--output-background-tab: #fcfcfc;
--output-current-tab: #f9ffff;

/* Output compiler highlighting */
--output-highlight-error-color: #bf1b1b;
--output-highlight-warning-color: #f79a06;
}

@define-mixin dark-theme-vars {
--positive-luminance: black;
--negative-luminance: white;

/* Fonts */
--font-color: #b4aea6;
--font-color: #dcdbd8;
--font-color-high-contrast: #dcdbd8;

/* Links */
--link-color: #308af2;
--link-color-visited: #9f5fe1;
--link-color: #b2dcff;
--link-color-visited: #eecaff;

/* Background */
--background-color: #292c2e;
--background-color-high-contrast: #17191a;
--background-color: #444;
--background-color-high-contrast: #181818;

/* Code */
--code-background-color: #3c3c3c;

/* Border */
--border-color: #404548;
--border-color: #5e5e5e;

/* Header */
--header-main-border: #363b3d;
--header-accent-border: #bdbdbd;

/* The big red button */
--button-primary-color: #dcdbd8;
--button-primary-bg-color: #81331a;
--button-primary-bg-color: #5d2310;
--button-primary-border-color: #612714;

/* Not the big red button */
--button-secondary-color: #b4aea6;
--button-secondary-color: #dcdbd8;
--button-secondary-bg-color-top: #17191a;
--button-secondary-bg-color-bottom: #1a1c1d;
--button-secondary-border-color: color-mix(
in hsl,
var(--button-secondary-bg-color-bottom),
var(--negative-luminance) 40%
);

/* Output tabs */
--output-background-tab: #191b1c;
--output-current-tab: #343434;
--output-background-tab: #343434;
--output-current-tab: #191b1c;

/* Output compiler highlighting */
--output-highlight-warning-color: #ffe800;
--output-highlight-warning-bg-color: #330;
--output-highlight-error-color: #f5f5f5;
--output-highlight-error-bg-color: #820000;
}

:root,
Expand Down Expand Up @@ -195,15 +210,18 @@ body {
background-color: var(--background-color);
padding: 0 1em;
font-family: var(--primary-font);
font-size: 18px;
}

/* stylelint-disable-next-line selector-class-pattern */
:global(.language-rust_errors) {
& :global(.warning) {
color: #f79a06;
color: var(--output-highlight-warning-color);
background-color: var(--output-highlight-warning-bg-color);
}

& :global(.error) {
color: #bf1b1b;
color: var(--output-highlight-error-color);
background-color: var(--output-highlight-error-bg-color);
}
}
3 changes: 2 additions & 1 deletion ui/frontend/shared.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.-bodyMonospace {
font-size: 0.9em;
font-size: inherit;
line-height: 1.25;

/* http://code.stephenmorley.org/html-and-css/fixing-browsers-broken-monospace-font-handling/
* ACE uses Monaco, Menlo, "Ubuntu Mono", Consolas, source-code-pro, monospace;
Expand Down

0 comments on commit 748fd36

Please sign in to comment.