Skip to content

Commit

Permalink
Add dark mode style mixin and color variables
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilafian committed Jun 27, 2024
1 parent 29894ca commit 605bd7a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/css/reset.less
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@
// Special font
@import url(https://fonts.googleapis.com/css?family=Chango);

// Custom Colors
:root {
--colorGraphite: #303030;
--colorCharcoal: #222222;
--colorTar: #161616;
}

// Core
* { box-sizing: border-box; }
html { display: flex; flex-direction: column; height: 100%; min-height: 100%; }
Expand Down
11 changes: 10 additions & 1 deletion src/css/reset/utility-box.less
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
// Style: Constants and Utilities -- Reusable values and mixins

// Custom Colors
@colorGraphite: #303030;
@colorCharcoal: #222222;
@colorTar: #161616;

// Layers for z-index
@layerDialogBox: 500; //cream of the crop
@layerModal: 400; //screen overlays
Expand All @@ -8,7 +13,7 @@
@layerHover: 100; //tootips and other hover popups
@layerBackground: -100; //bottom of the barrel

// Character entities
// Character Entities
@symbolAngleRight: "\276F"; //character: ❯
@symbolArrowDown: "\21E9"; //character: ⇩
@symbolArrowUp: "\21E7"; //character: ⇧
Expand All @@ -31,6 +36,10 @@
align-items: center;
}

.DarkMode(@lessRules) { //apply style if user has requested dark color themes
@media (prefers-color-scheme: dark) { @lessRules(); }
}

.MobileMode(@lessRules) { //selects iPhone 6/6s/7/8/SE2/SE3 landscape and anything narrower
@media (max-width: 667px) { @lessRules(); }
}
3 changes: 3 additions & 0 deletions src/js/lib-x.ts
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,9 @@ const libXBrowser = {
msWindows(): boolean {
return libX.browser.userAgentData().platform === 'Windows';
},
darkModeRequested(): boolean {
return window.matchMedia('(prefers-color-scheme: dark)').matches;
},
};

const libXPopupImage = {
Expand Down

0 comments on commit 605bd7a

Please sign in to comment.