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

Themes/colors are completely undocumented #12

Open
stevenpetryk opened this issue Sep 29, 2020 · 3 comments
Open

Themes/colors are completely undocumented #12

stevenpetryk opened this issue Sep 29, 2020 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@stevenpetryk
Copy link
Owner

stevenpetryk commented Sep 29, 2020

Themes are supported using CSS custom properties:

--mafs-bg: black;
--mafs-fg: white;

--mafs-origin-color: var(--mafs-fg);
--mafs-line-color: #555;
--grid-line-subdivision-color: #222;

--mafs-red: #f11d0e;
--mafs-orange: #f14e0e;
--mafs-yellow: #ffe44a;
--mafs-green: #15e272;
--mafs-blue: #58a6ff;
--mafs-indigo: #7c58ff;
--mafs-violet: #ae58ff;
--mafs-pink: #ee00ab;
export const theme = {
  foreground: "var(--mafs-fg)",
  background: "var(--mafs-bg)",

  red: "var(--mafs-red)",
  orange: "var(--mafs-orange)",
  green: "var(--mafs-green)",
  blue: "var(--mafs-blue)",
  indigo: "var(--mafs-indigo)",
  violet: "var(--mafs-violet)",
  pink: "var(--mafs-pink)",
}

But it might be nice to indicate how to swap out the Mafs default theme (right now, the main way is to overwrite these custom properties on .MafsView, as in the home page riemann sum example.

@stevenpetryk stevenpetryk added the documentation Improvements or additions to documentation label Sep 29, 2020
@stevenpetryk stevenpetryk modified the milestone: v0.2.0 Jan 2, 2023
@axelfran
Copy link

Hi,

I'm new to CSS variables and have been scratching my head about this. How would you go about to overwrite the custom properties in a NextJS app?

It would be awesome to be able to change the theme more easily! Thanks for making this awesome library 🎉

@stevenpetryk
Copy link
Owner Author

stevenpetryk commented Jan 21, 2023

Hey @axelfran, sorry I missed this!

You can see the custom properties that are set on MafsView here.

To change them from a Next.js app (or any app tbh!), you can just reassign them (after importing mafs/core.css so that your styles "win"):

.MafsView {
  --mafs-fg: tomato;
  --mafs-red: pink; /* controversial */
}

@axelfran
Copy link

Brilliant @stevenpetryk! 🥇

Thank you for your assistance 😄

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

No branches or pull requests

2 participants