Skip to content

Commit

Permalink
add feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
riknoll committed Apr 16, 2024
1 parent ad7c1d5 commit ed87f5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions localtypings/pxtarget.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ declare namespace pxt {
timeMachineQueryParams?: string[]; // An array of query params to pass to timemachine iframe embed
timeMachineDiffInterval?: number; // An interval in milliseconds at which to take diffs to store in project history. Defaults to 5 minutes
timeMachineSnapshotInterval?: number; // An interval in milliseconds at which to take full project snapshots in project history. Defaults to 15 minutes
adjustBlockContrast?: boolean; // If set to true, all block colors will automatically be adjusted to have a contrast ratio of 4.5 with text
}

interface DownloadDialogTheme {
Expand Down
2 changes: 2 additions & 0 deletions pxtlib/toolbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ namespace pxt.toolbox {
* concern since we only cache colors that are used in the toolbox.
*/
export function getAccessibleBackground(color: string) {
if (!pxt.appTarget?.appTheme?.adjustBlockContrast) return color;

if (!cachedAccessibleColors[color]) {
cachedAccessibleColors[color] = pxt.getWhiteContrastingBackground(color);
}
Expand Down

0 comments on commit ed87f5a

Please sign in to comment.