Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dark mode #18

Open
alixander opened this issue Dec 28, 2022 · 6 comments
Open

dark mode #18

alixander opened this issue Dec 28, 2022 · 6 comments

Comments

@alixander
Copy link
Contributor

https://www.reddit.com/r/d2lang/comments/zrj6ip/please_add_dark_mode_to_the_playground_that_would/

@alixander
Copy link
Contributor Author

design:

1280 - dark mode

@alixander alixander changed the title dark mode request dark mode Aug 26, 2023
@Silverbullet069
Copy link

Silverbullet069 commented Nov 30, 2024

Keep using Dark Reader, paste this code into your userContent.css file:

@-moz-document domain(play.d2lang.com) {
  /* NOTE: works alongside Dark Reader*/
  
  /* alixanser's design color palette */
  :root {
    --background: #0a0f25;
    --foreground: #e3e1dd;
    --sketch-overlay-1: #070b67;
    --sketch-overlay-2: #3733e9;
    --database: #7240dd;
    --file: #01799d;
  }

  /* TODO: change editor's caret color */
  div[class="cursor monaco-mouse-cursor-text "] {
    background-color: var(--foreground) !important;
  }

  #hero-center-drawing-img {
    mix-blend-mode: overlay !important;
    background-color: var(--foreground) !important;
  }

  /* background editor */
  .margin, .monaco-editor, .monaco-editor-background {
    background-color: var(--background) !important;
    caret-color: revert !important;
  }

  /* background component */
  [class^=" sketch-overlay-"] {
    fill: var(--background) !important;
  }

  /* Text */
  [class^="text-"] {
    mix-blend-mode: difference !important;
  }

  /* Latex */
  g[data-mml-node="math"] {
    color: var(--foreground) !important;
  }

  /* SVG images */
  /* required specific selector, not recommended */
  /* [class*="fill-"] {
    fill: var(--background) !important;
  } */
  
  [href^="data:image/svg+xml"] {
    filter: invert(100%) sepia(0%) saturate(26%) hue-rotate(88deg) brightness(105%) contrast(108%) !important;
    mix-blend-mode: difference !important;
  }
}

Of course, d2 supports custom styling, but the playground's UI is white and we want that to be dark mode as well. So disable Dark Reader is a no-go.
BUT, Dark Reader will change d2 compiled components' color on web so it will incorporate inconsistency inside exported diagram custom styling is meddled. So, custom styling shouldn't be used at all while working on Playground. That's fine by me, fine-grained diagram tweaking can take a lot of time for nothing, default is always the better.

UPDATE: Took me 3 hours to change to caret color :v

@Silverbullet069
Copy link

@alixander Your design is truly beautiful, if you share the color palette I can work on it if I got some free time.

@Silverbullet069
Copy link

Alternative: disable Dark Reader, use "Dark Mauve":

vars: {
  d2-config: {
    layout-engine: dagre
    theme-id: 200
  }
}

@alixander
Copy link
Contributor Author

if you share the color palette I can work on it if I got some free time.

I don't have it handy right now, will in a few weeks, but I use a browser extension to get colors, maybe that could be helpful in the meantime: https://chromewebstore.google.com/detail/colorzilla/bhlhnicpbhignbdhedgjhgdocnmhomnp?hl=en

We'd of course welcome & appreciate such a contribution.

@Silverbullet069
Copy link

if you share the color palette I can work on it if I got some free time.

I don't have it handy right now, will in a few weeks, but I use a browser extension to get colors, maybe that could be helpful in the meantime: https://chromewebstore.google.com/detail/colorzilla/bhlhnicpbhignbdhedgjhgdocnmhomnp?hl=en

We'd of course welcome & appreciate such a contribution.

Yep I used Firefox DevTool Color Picker to extract some colors in your design. I will look into it soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants