Skip to content

Commit

Permalink
Default chrome://dino to "night mode" when using dark mode
Browse files Browse the repository at this point in the history
Bug: 1026136
Change-Id: Ic9c7f4f12e20e2834f47e8610b723da398170301
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1923907
Commit-Queue: Cathy Li <chili@chromium.org>
Reviewed-by: Cathy Li <chili@chromium.org>
Cr-Commit-Position: refs/heads/master@{#716813}
  • Loading branch information
bsclifton authored and Commit Bot committed Nov 19, 2019
1 parent 20b9b8e commit 9bf6154
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ Bobby Powers <bobbypowers@gmail.com>
Branden Archer <bma4@zips.uakron.edu>
Brendan Kirby <brendan.kirby@imgtec.com>
Brendan Long <self@brendanlong.com>
Brian Clifton <clifton@brave.com>
Brian G. Merrell <bgmerrell@gmail.com>
Brian Konzman, SJ <b.g.konzman@gmail.com>
Brian Luft <brian@electroly.com>
Expand Down
13 changes: 11 additions & 2 deletions components/neterror/resources/offline.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,14 @@ Runner.prototype = {

window.addEventListener(Runner.events.RESIZE,
this.debounceResize.bind(this));

// Handle dark mode
const darkModeMediaQuery =
window.matchMedia('(prefers-color-scheme: dark)');
this.isDarkMode = darkModeMediaQuery && darkModeMediaQuery.matches;
darkModeMediaQuery.addListener((e) => {
this.isDarkMode = e.matches;
});
},

/**
Expand Down Expand Up @@ -576,9 +584,10 @@ Runner.prototype = {
if (this.playingIntro) {
this.horizon.update(0, this.currentSpeed, hasObstacles);
} else {
const showNightMode = this.isDarkMode ^ this.inverted;
deltaTime = !this.activated ? 0 : deltaTime;
this.horizon.update(deltaTime, this.currentSpeed, hasObstacles,
this.inverted);
this.horizon.update(
deltaTime, this.currentSpeed, hasObstacles, showNightMode);
}

// Check for collisions.
Expand Down

0 comments on commit 9bf6154

Please sign in to comment.