<commit_before>// TODO: This should be replaced with a styled-components theme

import { createGlobalStyle } from 'styled-components'
import Cookies from 'cookies-js'

export const toggle = mode => {
  const { theme } = document.documentElement.dataset
  const nextTheme = { dark: 'default', default: 'dark' }[theme]
  document.documentElement.dataset.theme = mode || nextTheme
  const cookieFlag = { dark: '1', default: '0' }[nextTheme]
  Cookies.set('is-inverted', cookieFlag)
}

export default createGlobalStyle`
  html[data-theme='dark'] {
    &,
    img,
    canvas,
    [style*='background-image'] {
      filter: invert(100%) hue-rotate(180deg);

      iframe {
        filter: invert(100%) hue-rotate(180deg);
      }
    }

    // Chrome
    @media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) {
      body {
        background-color: black;
      }
    }

    // Safari 8+
    _::-webkit-full-page-media,
    _:future,
    :root {<commit_msg>Fix background for chrome dark mode<commit_after>// TODO: This should be replaced with a styled-components theme

import { createGlobalStyle } from 'styled-components'
import Cookies from 'cookies-js'

export const toggle = mode => {
  const { theme } = document.documentElement.dataset
  const nextTheme = { dark: 'default', default: 'dark' }[theme]
  document.documentElement.dataset.theme = mode || nextTheme
  const cookieFlag = { dark: '1', default: '0' }[nextTheme]
  Cookies.set('is-inverted', cookieFlag)
}

export default createGlobalStyle`
  html[data-theme='dark'] {
    &,
    img,
    canvas,
    [style*='background-image'] {
      filter: invert(100%) hue-rotate(180deg);

      iframe {
        filter: invert(100%) hue-rotate(180deg);
      }
    }

    // Chrome
    @media all and (-webkit-min-device-pixel-ratio: 0) and (min-resolution: 0.001dpcm) {
      body {
        background-color: white;
      }
    }

    // Safari 8+
    _::-webkit-full-page-media,
    _:future,
    :root {
{'fraction_non_alphanumeric': 0.13883299798792756, 'fraction_numerical': 0.02012072434607646, 'mean_word_length': 2.9939759036144578, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1118780', 'n_tokens_mistral': 679, 'n_tokens_neox': 621, 'n_words': 155}