Skip to content

Commit cfcfe64

Browse files
authored
Add dark mode debug flag (keybase#19776)
* add party mode debug flag sets all non-grayscale colors to magenta in dark mode * 🔥 commented code * make border colors more obvious in party mode
1 parent 4cb5cdb commit cfcfe64

5 files changed

Lines changed: 61 additions & 0 deletions

File tree

‎shared/__mocks__/local-debug.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const immediateStateLogging = false
1313
export const isDevApplePushToken = false
1414
export const isTesting = false
1515
export const maskStrings = false
16+
export const partyMode = false
1617
export const printOutstandingRPCs = false
1718
export const printOutstandingTimerListeners = false
1819
export const printRPC = false

‎shared/local-debug.d.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export declare const ignoreDisconnectOverlay: boolean
88
export declare const immediateStateLogging: boolean
99
export declare const isDevApplePushToken: boolean
1010
export declare const isTesting: boolean
11+
export declare const partyMode: boolean
1112
export declare const printOutstandingRPCs: boolean
1213
export declare const printOutstandingTimerListeners: boolean
1314
export declare const printRPC: boolean

‎shared/local-debug.desktop.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ let config = {
1515
immediateStateLogging: false, // Don't wait for idle to log state
1616
isDevApplePushToken: false,
1717
isTesting: __STORYBOOK__, // Is running a unit test
18+
partyMode: false,
1819
printOutstandingRPCs: false, // Periodically print rpcs we're waiting for
1920
printOutstandingTimerListeners: false, // Periodically print listeners to the second clock
2021
printRPC: false, // Print rpc traffic
@@ -121,6 +122,7 @@ export const {
121122
isDevApplePushToken,
122123
immediateStateLogging,
123124
isTesting,
125+
partyMode,
124126
printOutstandingRPCs,
125127
printOutstandingTimerListeners,
126128
printRPC,

‎shared/local-debug.native.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ let config = {
4040
immediateStateLogging: false, // Don't wait for idle to log state
4141
isDevApplePushToken: false, // Use a dev push token
4242
isTesting: nativeBridge.test === '1' || (NativeModules.Storybook && NativeModules.Storybook.isStorybook), // Is running a unit test
43+
partyMode: false,
4344
printOutstandingRPCs: false, // Periodically print rpcs we're waiting for
4445
printOutstandingTimerListeners: false, // Periodically print listeners to the second clock
4546
printRPC: false, // Print rpc traffic
@@ -125,6 +126,7 @@ export const {
125126
immediateStateLogging,
126127
isDevApplePushToken,
127128
isTesting,
129+
partyMode,
128130
printOutstandingRPCs,
129131
printOutstandingTimerListeners,
130132
printRPC,

‎shared/styles/colors.tsx‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// the _on_white are precomputed colors so we can do less blending on mobile
22
import {isDarkMode} from './dark-mode'
3+
import {partyMode} from '../local-debug'
34
import {isIOS} from '../constants/platform'
45

56
export const colors = {
@@ -262,6 +263,55 @@ export const darkColors: {[P in keyof typeof colors]: string | undefined} = {
262263
yellowLight: '#FFFDCC',
263264
}
264265

266+
const partyFallbackColors = {
267+
black: 'rgba(255, 255, 255, 0.85)',
268+
get blackOrBlack() {
269+
return colors.black
270+
},
271+
get blackOrWhite() {
272+
return colors.white
273+
},
274+
get black_05OrBlack_60() {
275+
return colors.black_60
276+
},
277+
black_05_on_white: 'rgb(13, 13, 13)',
278+
black_10_on_white: 'rgb(26, 26, 26)',
279+
get black_20OrBlack() {
280+
return colors.black
281+
},
282+
black_20_on_white: 'rgb(51, 51, 51)',
283+
get black_50OrWhite() {
284+
return colors.white
285+
},
286+
get black_50OrWhite_75() {
287+
return colors.white_75
288+
},
289+
black_50_on_white: 'rgb(128, 128, 128)',
290+
black_60: 'rgba(255, 255, 255, 0.60)',
291+
black_63: 'rgba(255, 255, 255, 0.63)',
292+
black_on_white: 'rgb(217, 217, 217)',
293+
transparent: 'rgba(255, 255, 255, 0)',
294+
transparent_on_white: '#191919',
295+
white: '#191919',
296+
get whiteOrBlack() {
297+
return colors.black
298+
},
299+
get whiteOrGreenDark() {
300+
return '#FF00FF'
301+
},
302+
white_0: 'rgba(25, 25, 25, 0)',
303+
white_0_on_white: '#191919',
304+
white_20_on_white: '#191919',
305+
get white_40OrBlack_60() {
306+
return colors.black_60
307+
},
308+
white_40_on_white: '#191919',
309+
white_75: 'rgba(25, 25, 25, 0.75)',
310+
white_75_on_white: '#191919',
311+
white_90: 'rgba(25, 25, 25, 0.90)',
312+
white_90_on_white: '#191919',
313+
}
314+
265315
type Color = typeof colors
266316
type Names = keyof Color
267317

@@ -272,6 +322,11 @@ export const themed = names.reduce<Color>(
272322
configurable: false,
273323
enumerable: true,
274324
get() {
325+
if (partyMode && isDarkMode()) {
326+
// sets all non-grayscale colors to magenta in dark mode when enabled
327+
return partyFallbackColors[name] || '#FF00FF'
328+
}
329+
275330
return isDarkMode() ? darkColors[name] : colors[name]
276331
},
277332
}),

0 commit comments

Comments
 (0)