mafs icon indicating copy to clipboard operation
mafs copied to clipboard

Themes/colors are completely undocumented

Open stevenpetryk opened this issue 5 years ago • 3 comments

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 avatar Sep 29 '20 06:09 stevenpetryk

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 🎉

axelfran avatar Jan 18 '23 21:01 axelfran

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 */
}

stevenpetryk avatar Jan 21 '23 18:01 stevenpetryk

Brilliant @stevenpetryk! 🥇

Thank you for your assistance 😄

axelfran avatar Jan 22 '23 14:01 axelfran