INNER CODE UNIT · JavaScript

mountDarkMode

cisagov/ScubaGoggles · scubagoggles/reporter/scripts/main.js:70

const mountDarkMode = () => {
    // First, check session storage to see if dark mode has already been
    // enabled or disabled. If it has, this is what should take precedence.
    // "darkMode" setting will either be "true", "false", or undefined
    const darkModeSessionVariable = getSetting("darkMode");
    if (
        darkModeSessionVariable !== null &&
        darkModeSessionVariable !== undefined
    ) {
        setDarkMode(darkModeSessionVariable);
        return;
    }

    // Next, check to see if the user specified the dark mode via the --darkmode
    // CLI argument. The Python code dynamically inserts the value of that arg
    // as the "data-darkmode" attribute of the #sgr_settings element. The value
    // will be a string, either "true" (dark mode is enabled), "false" (disabled),
    // or "None" (not specified).

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…