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

feat: custom css #2120

Merged
merged 6 commits into from
Aug 27, 2024
Merged

feat: custom css #2120

merged 6 commits into from
Aug 27, 2024

Conversation

mscolnick
Copy link
Contributor

@mscolnick mscolnick commented Aug 26, 2024

Closes #2063
Partly addresses #989

This adds an app config option to point to a custom.css file.

The filepath can be configured in the marimo editor. The file itself can be edited in marimo or your own editor.


app = marimo.App(css_file="custom.css")

CSS Variables

We support only a few CSS variables as part of the "public API" for theming. These are:

--marimo-monospace-font
--marimo-text-font
--marimo-heading-font
:class: warning

We cannot guarantee that other CSS variables or classnames will be stable across versions.

Example

Here is an example of a custom CSS file that changes the font of the notebook:

/* Load Inter from Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');

:root {
  --marimo-heading-font: 'Inter', sans-serif;
}

/* Increase paragraph font size and change color */
.paragraph {
  font-size: 1.2rem;
  color: light-dark(navy, pink);
}

Copy link

vercel bot commented Aug 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
marimo-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 27, 2024 3:28pm
marimo-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 27, 2024 3:28pm

Copy link
Contributor

@akshayka akshayka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Just one small comment then LGTM

@mscolnick mscolnick merged commit 42e16c3 into main Aug 27, 2024
31 checks passed
@mscolnick mscolnick deleted the ms/custom-css branch August 27, 2024 15:41
Copy link

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.8.4-dev13

@mscolnick mscolnick mentioned this pull request Aug 29, 2024
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

Successfully merging this pull request may close these issues.

Content created through JS bypasses user defined CSS
2 participants