Skip to content

Support dark mode #3585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ docker-compose.override.yml
*~
src/schema.rs.orig

.DS_Store
3 changes: 3 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import Resolver from 'ember-resolver';

import config from './config/environment';
import * as Sentry from './sentry';
import { theme } from './utils/theme';

theme.loadSettingTheme();

if (typeof FastBoot === 'undefined') {
// eslint-disable-next-line unicorn/prefer-add-event-listener
Expand Down
4 changes: 2 additions & 2 deletions app/components/crate-downloads-list.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
}

.link {
color: #525252;
background-color: #edebdd;
color: var(--download-list-link);
background-color: var(--main-bg-dark);
font-size: 90%;
padding: 20px 10px;
display: flex;
Expand Down
5 changes: 2 additions & 3 deletions app/components/crate-row.module.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
.crate-row {
--shadow: 0 1px 3px hsla(51, 90%, 42%, .35);

display: flex;
flex-wrap: wrap;
padding: 15px 25px;
background-color: white;
background-color: var(--item-background);
color: var(--item);
border-radius: 5px;
box-shadow: var(--shadow);
transition: all 300ms;
Expand Down
7 changes: 3 additions & 4 deletions app/components/dependency-list/row.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@
--range-color: var(--grey900);
--crate-color: var(--grey700);
--placeholder-opacity: 0.35;
--shadow: 0 1px 3px hsla(51, 90%, 42%, .35);


display: flex;
align-items: center;
position: relative;
font-size: 18px;
padding: 15px 25px;
background-color: white;
background-color: var(--item-background);
border-radius: 5px;
box-shadow: var(--shadow);
transition: all 300ms;

&:hover, &.focused {
background-color: var(--hover-bg-color);
background-color: var(--item-hover);
transition: all 0ms;
}

Expand Down
5 changes: 3 additions & 2 deletions app/components/dropdown/menu-item.module.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
.item {
> a, button {
> a, span, button {
font-size: 90%;
width: 100%;
display: inline-flex;
text-align: start;
padding: 8px 10px;
text-decoration: none;
cursor: pointer;
color: var(--main-color) !important;

&:hover {
background: #5e5e5e;
background: var(--menu-hover);
color: white !important;
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/components/dropdown/menu.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
margin: 0;
text-align: left;
padding: 0;
background: white;
background: var(--item-background);
border: 1px solid var(--gray-border);
list-style: none;
overflow: hidden;
Expand Down
2 changes: 1 addition & 1 deletion app/components/email-input.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

.row {
width: 100%;
border: 1px solid #d5d3cb;
border: 1px solid var(--gray-border);
border-bottom-width: 0;
padding: 10px 20px;
display: flex;
Expand Down
13 changes: 6 additions & 7 deletions app/components/front-page-list/item.module.css
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
.link {
--shadow: 0 2px 3px hsla(51, 50%, 44%, .35);

display: flex;
align-items: center;
width: 100%;
height: 60px;
margin: 8px 0;
padding: 0 15px;
background-color: white;
color: #525252;
background-color: var(--item-background);
color: var(--item);
text-decoration: none;
border-radius: 5px;
box-shadow: var(--shadow);
box-shadow: var(--shadow2);
transition: background-color 300ms;

&:focus-visible {
Expand All @@ -20,14 +19,14 @@
}

&:hover, &:focus-visible {
color: #525252;
background-color: hsl(58deg 72% 97%);
color: var(--download-list-link);
background-color: var(--item-hover);
transition: background-color 0ms;
}

&:active {
transform: translateY(2px);
--shadow: inset 0 0 0 1px hsla(51, 50%, 44%, .15);
box-shadow: inset 0 0 0 1px hsla(51, 50%, 44%, .15);;
}
}

Expand Down
7 changes: 3 additions & 4 deletions app/components/front-page-list/item/placeholder.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.link {
--shadow: 0 2px 3px hsla(51, 50%, 44%, .35);
--placeholder-bg: hsla(59, 19%, 50%, 1.0);
--placeholder-bg2: hsla(59, 19%, 50%, 0.7);

Expand All @@ -9,10 +8,10 @@
height: 60px;
margin: 8px 0;
padding: 0 15px;
background-color: white;
color: #525252;
background-color: var(--item-background);
color: var(--download-list-link);
border-radius: 5px;
box-shadow: var(--shadow);
box-shadow: var(--shadow2);
cursor: wait;
}

Expand Down
11 changes: 11 additions & 0 deletions app/components/header.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@
Browse All Crates
</LinkTo>
<span local-class="sep">|</span>
<Dropdown as |dd|>
<dd.Trigger local-class="dropdown-button">
Theme
</dd.Trigger>
<dd.Menu local-class="doc-links" as |menu|>
<menu.Item onclick={{this.useSystemTheme}}><span>Sync with system</span></menu.Item>
<menu.Item onclick={{this.useLightTheme}}><span>Light theme</span></menu.Item>
<menu.Item onclick={{this.useDarkTheme}}><span>Dark theme</span></menu.Item>
</dd.Menu>
</Dropdown>
<span local-class="sep">|</span>
<Dropdown as |dd|>
<dd.Trigger local-class="dropdown-button">
Docs
Expand Down
14 changes: 14 additions & 0 deletions app/components/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { action } from '@ember/object';
import { inject as service } from '@ember/service';
import Component from '@glimmer/component';

import { theme } from '../utils/theme';

export default class Header extends Component {
@service header;
@service router;
Expand All @@ -20,4 +22,16 @@ export default class Header extends Component {
},
});
}

@action useSystemTheme() {
theme.useSystemTheme();
}

@action useLightTheme() {
theme.useLightTheme();
}

@action useDarkTheme() {
theme.useDarkTheme();
}
}
8 changes: 4 additions & 4 deletions app/components/owned-crate-row.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
display: flex;
align-items: center;
background-color: #fff;
border: 1px solid #d5d3cb;
border: 1px solid var(--gray-border);
padding: 20px 30px;
font-weight: bold;
cursor: pointer;
Expand All @@ -24,12 +24,12 @@
width: 36px;
height: 36px;
margin-left: 10px;
border: 2px solid #d5d3cb;
border: 2px solid var(--gray-border);
border-radius: 50%;

.checked & {
background-color: #cfc487;
border-color: #cfc487;
background-color: var(--owned-crate-checked);
border-color: var(--owned-crate-checked);
}
}

Expand Down
7 changes: 4 additions & 3 deletions app/components/rendered-html.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@

p {
code {
background-color: #fff;
padding: 0 2px;
background-color: var(--code);
padding: 0 4px;
border-radius: 2px;
}
}

Expand All @@ -35,7 +36,7 @@
overflow-x: auto;

th, td {
border: 1px solid #dfe2e5;
border: 1px solid var(--rendered-html-table);
padding: 6px 13px;
}
}
Expand Down
7 changes: 3 additions & 4 deletions app/components/rev-dep-row.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@
--hover-bg-color: hsl(217, 37%, 98%);
--crate-color: var(--grey700);
--placeholder-opacity: 0.35;
--shadow: 0 1px 3px hsla(51, 90%, 42%, .35);


position: relative;
font-size: 18px;
padding: 15px 25px;
background-color: white;
background-color: var(--item-background);
border-radius: 5px;
box-shadow: var(--shadow);
transition: all 300ms;

&:hover, &.focused {
background-color: var(--hover-bg-color);
background-color: var(--item-hover);
transition: all 0ms;
}

Expand Down
2 changes: 1 addition & 1 deletion app/components/settings/api-tokens.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

.row {
width: 100%;
border: 1px solid #d5d3cb;
border: 1px solid var(--gray-border);
border-bottom-width: 0;
padding: 10px 20px;
display: flex;
Expand Down
7 changes: 3 additions & 4 deletions app/components/version-list/row.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
--bg-color: var(--grey200);
--hover-bg-color: hsl(217, 37%, 98%);
--fg-color: var(--grey700);
--shadow: 0 1px 3px hsla(51, 90%, 42%, .35);

display: flex;
align-items: center;
position: relative;
font-size: 18px;
padding: 15px 25px;
background-color: white;
background-color: var(--item-background);
border-radius: 5px;
box-shadow: var(--shadow);
box-shadow: var(--shadow2);
transition: all 300ms;

&:hover, &.focused {
background-color: var(--hover-bg-color);
background-color: var(--item-hover);
transition: all 0ms;
}

Expand Down
2 changes: 1 addition & 1 deletion app/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" data-color-mode="auto" data-light-theme="light" data-dark-theme="dark">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down
20 changes: 8 additions & 12 deletions app/styles/application.module.css
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
@import url(./theme.module.css);

:root {
--violet800: hsl(252, 44%, 24%);
--grey900: hsl(200, 15%, 19%);
--grey700: hsl(200, 11%, 43%);
--grey600: hsl(200, 13%, 60%);
--grey200: hsl(200, 17%, 96%);
--green800: hsl(115, 31%, 31%);
--yellow500: hsl(44, 100%, 60%);

--header-bg-color: var(--green800);
--footer-bg-color: var(--green800);

--font-sans: "Fira Sans", sans-serif;
--font-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

--main-color: #383838;
--main-color-light: #858585;
--main-bg: #f9f7ec;
--main-bg-dark: #edebdd;
--gray-border: #d5d3cb;
--link-color: rgb(0, 172, 91);
--link-hover-color: #007940;
--separator-color: #284725;

--download-list-link: #525252;
--owned-crate-checked: #cfc487;
--rendered-html-table: #dfe2e5;
--placeholder-bg: hsl(212, 7%, 57%);
--placeholder-bg2: hsl(213, 16%, 75%);
--separator-color: #284725;
--link-hover-color: #007940;
--link-color: rgb(0, 172, 91);
}

:global(.new-design) {
Expand Down
9 changes: 5 additions & 4 deletions app/styles/crate/version.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
}

.docs {
--shadow: 0 2px 3px hsla(51, 50%, 44%, .35);

margin-bottom: 25px;
padding: 25px;
background-color: white;
background-color: var(--item-background);
border-radius: 5px;
box-shadow: var(--shadow);
box-shadow: var(--shadow2);

@media only screen and (max-width: 550px) {
margin-left: -15px;
Expand Down Expand Up @@ -104,6 +102,9 @@
font-size: 160%;
font-weight: bold;
margin-bottom: 4px;
circle {
fill: #fff;
}
}

.num__align {
Expand Down
2 changes: 1 addition & 1 deletion app/styles/crates.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
justify-content: space-between;
padding: 20px;
border-radius: 5px;
background-color: white;
background-color: var(--item-background);
margin-bottom: 40px;

a {
Expand Down
2 changes: 1 addition & 1 deletion app/styles/dashboard.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
}

.feed {
background: white;
background: var(--item-background);
padding: 0 20px 20px;
}

Expand Down
Loading