Skip to content

Instantly share code, notes, and snippets.

@abhigyantrips
Last active March 10, 2025 03:15
Show Gist options
  • Save abhigyantrips/b828ca46b2460c6699c73e0162f6be80 to your computer and use it in GitHub Desktop.
Save abhigyantrips/b828ca46b2460c6699c73e0162f6be80 to your computer and use it in GitHub Desktop.
This is a list of all CSS variables for Docusaurus (@docusaurus/preset-classic), which uses Infima (https://infima.dev/) as its styling framework.
/*
Docusaurus CSS Variables.
I'm making this since I wanted to customize my Docusaurus site theme, but couldn't find a proper list of all Infima CSS variables
the static site generator uses. Thus, I basically copied the root of my site's CSS (along with other vars I found), and made a list
of them that categorizes the vars.
TABLE OF CONTENTS:
1. (L037) BACKGROUND/FOREGROUND, COLOR SCHEME, CONSTRAST
2. (L146) FONTS, TEXT SPACING, TRANSITIONS
3. (L184) CODEBLOCKS, HEADINGS, LISTS/TABLES, MENUS
4. (L242) LINKS, BLOCKQUOTES, TOC, SCROLLBAR CONFIG.
5. (L275) INFIMA COMPONENTS (https://infima.dev/docs/components)
- (L278) ALERT (/alert)
- (L290) AVATAR (/avatar)
- (L299) BADGE (/badge)
- (L309) BREADCRUMBS (/breadcrumbs)
- (L323) BUTTON (/button)
- (L336) CARD (/card)
- (L343) DROPDOWN (/dropdown)
- (L350) FOOTER (/footer)
- (L361) HERO (/hero)
- (L366) NAVBAR (/navbar)
- (L383) PAGINATION NAV (/pagination-nav)
- (L388) PAGINATION (/pagination)
- (L399) PILLS (/pills)
- (L405) TABS (/tabs)
6. (L415) MISCELLANEOUS DOCUSAURUS VARIABLES
*/
:root {
/*
-------------- BACKGROUND/FOREGROUND, COLOR SCHEME, CONSTRAST --------------
*/
--ifm-color-scheme: light;
--ifm-dark-value: 10%;
--ifm-darker-value: 15%;
--ifm-darkest-value: 30%;
--ifm-light-value: 15%;
--ifm-lighter-value: 30%;
--ifm-lightest-value: 50%;
--ifm-contrast-background-value: 90%;
--ifm-contrast-foreground-value: 70%;
--ifm-contrast-background-dark-value: 70%;
--ifm-contrast-foreground-dark-value: 90%;
--ifm-color-primary: #3578e5;
--ifm-color-secondary: #ebedf0;
--ifm-color-success: #00a400;
--ifm-color-info: #54c7ec;
--ifm-color-warning: #ffba00;
--ifm-color-danger: #fa383e;
--ifm-color-primary-dark: #306cce;
--ifm-color-primary-darker: #2d66c3;
--ifm-color-primary-darkest: #2554a0;
--ifm-color-primary-light: #538ce9;
--ifm-color-primary-lighter: #72a1ed;
--ifm-color-primary-lightest: #9abcf2;
--ifm-color-primary-contrast-background: #ebf2fc;
--ifm-color-primary-contrast-foreground: #102445;
--ifm-color-secondary-dark: #d4d5d8;
--ifm-color-secondary-darker: #c8c9cc;
--ifm-color-secondary-darkest: #a4a6a8;
--ifm-color-secondary-light: #eef0f2;
--ifm-color-secondary-lighter: #f1f2f5;
--ifm-color-secondary-lightest: #f5f6f8;
--ifm-color-secondary-contrast-background: #fdfdfe;
--ifm-color-secondary-contrast-foreground: #474748;
--ifm-color-success-dark: #009400;
--ifm-color-success-darker: #008b00;
--ifm-color-success-darkest: #007300;
--ifm-color-success-light: #26b226;
--ifm-color-success-lighter: #4dbf4d;
--ifm-color-success-lightest: #80d280;
--ifm-color-success-contrast-background: #e6f6e6;
--ifm-color-success-contrast-foreground: #003100;
--ifm-color-info-dark: #4cb3d4;
--ifm-color-info-darker: #47a9c9;
--ifm-color-info-darkest: #3b8ba5;
--ifm-color-info-light: #6ecfef;
--ifm-color-info-lighter: #87d8f2;
--ifm-color-info-lightest: #aae3f6;
--ifm-color-info-contrast-background: #eef9fd;
--ifm-color-info-contrast-foreground: #193c47;
--ifm-color-warning-dark: #e6a700;
--ifm-color-warning-darker: #d99e00;
--ifm-color-warning-darkest: #b38200;
--ifm-color-warning-light: #ffc426;
--ifm-color-warning-lighter: #ffcf4d;
--ifm-color-warning-lightest: #ffdd80;
--ifm-color-warning-contrast-background: #fff8e6;
--ifm-color-warning-contrast-foreground: #4d3800;
--ifm-color-danger-dark: #e13238;
--ifm-color-danger-darker: #d53035;
--ifm-color-danger-darkest: #af272b;
--ifm-color-danger-light: #fb565b;
--ifm-color-danger-lighter: #fb7478;
--ifm-color-danger-lightest: #fd9c9f;
--ifm-color-danger-contrast-background: #ffebec;
--ifm-color-danger-contrast-foreground: #4b1113;
--ifm-color-white: #fff;
--ifm-color-black: #000;
--ifm-color-gray-0: var(--ifm-color-white);
--ifm-color-gray-100: #f5f6f7;
--ifm-color-gray-200: #ebedf0;
--ifm-color-gray-300: #dadde1;
--ifm-color-gray-400: #ccd0d5;
--ifm-color-gray-500: #bec3c9;
--ifm-color-gray-600: #8d949e;
--ifm-color-gray-700: #606770;
--ifm-color-gray-800: #444950;
--ifm-color-gray-900: #1c1e21;
--ifm-color-gray-1000: var(--ifm-color-black);
--ifm-color-emphasis-0: var(--ifm-color-gray-0);
--ifm-color-emphasis-100: var(--ifm-color-gray-100);
--ifm-color-emphasis-200: var(--ifm-color-gray-200);
--ifm-color-emphasis-300: var(--ifm-color-gray-300);
--ifm-color-emphasis-400: var(--ifm-color-gray-400);
--ifm-color-emphasis-600: var(--ifm-color-gray-600);
--ifm-color-emphasis-700: var(--ifm-color-gray-700);
--ifm-color-emphasis-800: var(--ifm-color-gray-800);
--ifm-color-emphasis-900: var(--ifm-color-gray-900);
--ifm-color-emphasis-1000: var(--ifm-color-gray-1000);
--ifm-color-content: var(--ifm-color-emphasis-900);
--ifm-color-content-inverse: var(--ifm-color-emphasis-0);
--ifm-color-content-secondary: #525860;
--ifm-background-color: transparent;
--ifm-background-surface-color: var(--ifm-color-content-inverse);
/*
--------------------- FONTS, TEXT SPACING, TRANSITIONS ---------------------
*/
--ifm-global-border-width: 1px;
--ifm-global-radius: 0.4rem;
--ifm-global-spacing: 1rem;
--ifm-hover-overlay: rgba(0,0,0,.05);
--ifm-font-color-base: var(--ifm-color-content);
--ifm-font-color-base-inverse: var(--ifm-color-content-inverse);
--ifm-font-color-secondary: var(--ifm-color-content-secondary);
--ifm-font-family-base: "...";
--ifm-font-family-monospace: "...";
--ifm-font-size-base: 100%;
--ifm-font-weight-light: 300;
--ifm-font-weight-normal: 400;
--ifm-font-weight-semibold: 500;
--ifm-font-weight-bold: 700;
--ifm-font-weight-base: var(--ifm-font-weight-normal);
--ifm-line-height-base: 1.65;
--ifm-spacing-vertical: var(--ifm-global-spacing);
--ifm-spacing-horizontal: var(--ifm-global-spacing);
--ifm-transition-fast: 200ms;
--ifm-transition-slow: 400ms;
--ifm-transition-timing-default: cubic-bezier(0.08,0.52,0.52,1);
--ifm-global-shadow-lw: 0 1px 2px 0 rgba(0,0,0,.1);
--ifm-global-shadow-md: 0 5px 40px rgba(0,0,0,.2);
--ifm-global-shadow-tl: 28px 0 rgba(0,0,0,.2),0 2px 4px 0 rgba(0,0,0,.1);
--ifm-z-index-dropdown: 2;
--ifm-z-index-fixed: 3;
--ifm-z-index-overlay: 4;
--ifm-container-width: 1140px;
--ifm-container-width-xl: 1320px;
/*
-------------------- CODEBLOCKS, HEADINGS, LISTS/TABLES --------------------
*/
--ifm-code-background: #f6f7f8;
--ifm-code-border-radius: var(--ifm-global-radius);
--ifm-code-font-size: 90%;
--ifm-code-padding-horizontal: 0.1rem;
--ifm-code-padding-vertical: 0.1rem;
--ifm-pre-background: var(--ifm-color-emphasis-100);
--ifm-pre-border-radius: var(--ifm-code-border-radius);
--ifm-pre-color: inherit;
--ifm-pre-line-height: 1.45;
--ifm-pre-padding: 1rem;
--ifm-heading-color: inherit;
--ifm-heading-margin-top: 0;
--ifm-heading-margin-bottom: var(--ifm-spacing-vertical);
--ifm-heading-font-family: var(--ifm-font-family-base);
--ifm-heading-font-weight: var(--ifm-font-weight-bold);
--ifm-heading-line-height: 1.25;
--ifm-h1-font-size: 2rem;
--ifm-h2-font-size: 1.5rem;
--ifm-h3-font-size: 1.25rem;
--ifm-h4-font-size: 1rem;
--ifm-h5-font-size: 0.875rem;
--ifm-h6-font-size: 0.85rem;
--ifm-image-alignment-padding: 1.25rem;
--ifm-leading-desktop: 1.25;
--ifm-leading: calc(var(--ifm-leading-desktop)*1rem);
--ifm-list-left-padding: 2rem;
--ifm-list-margin: 1rem;
--ifm-list-item-margin: 0.25rem;
--ifm-list-paragraph-margin: 1rem;
--ifm-table-cell-padding: 0.75rem;
--ifm-table-background: transparent;
--ifm-table-stripe-background: var(--ifm-color-emphasis-100);
--ifm-table-border-width: 1px;
--ifm-table-border-color: var(--ifm-color-emphasis-300);
--ifm-table-head-background: inherit;
--ifm-table-head-color: inherit;
--ifm-table-head-font-weight: var(--ifm-font-weight-bold);
--ifm-table-cell-color: inherit;
--ifm-menu-color: var(--ifm-color-emphasis-700);
--ifm-menu-color-active: var(--ifm-color-primary);
--ifm-menu-color-background-active: var(--ifm-hover-overlay);
--ifm-menu-color-background-hover: var(--ifm-hover-overlay);
--ifm-menu-link-padding-horizontal: 1rem;
--ifm-menu-link-padding-vertical: 0.375rem;
--ifm-menu-link-sublist-icon: url('...');
--ifm-menu-link-sublist-icon-filter: none;
/*
---------------- LINKS, BLOCKQUOTES, SCROLLBAR CONFIG., TOC ----------------
*/
--ifm-link-color: var(--ifm-color-primary);
--ifm-link-decoration: none;
--ifm-link-hover-color: var(--ifm-link-color);
--ifm-link-hover-decoration: underline;
--ifm-paragraph-margin-bottom: var(--ifm-leading);
--ifm-blockquote-font-size: var(--ifm-font-size-base);
--ifm-blockquote-border-left-width: 2px;
--ifm-blockquote-padding-horizontal: var(--ifm-spacing-horizontal);
--ifm-blockquote-padding-vertical: 0;
--ifm-blockquote-shadow: none;
--ifm-blockquote-color: var(--ifm-color-emphasis-800);
--ifm-blockquote-border-color: var(--ifm-color-emphasis-300);
--ifm-hr-border-color: var(--ifm-color-emphasis-500);
--ifm-hr-border-width: 1px;
--ifm-hr-margin-vertical: 1.5rem;
--ifm-toc-border-color: var(--ifm-color-emphasis-300);
--ifm-toc-link-color: var(--ifm-color-content-secondary);
--ifm-toc-padding-vertical: 0.5rem;
--ifm-toc-padding-horizontal: 0.5rem;
--ifm-scrollbar-size: 7px;
--ifm-scrollbar-track-background-color: #f1f1f1;
--ifm-scrollbar-thumb-background-color: silver;
--ifm-scrollbar-thumb-hover-background-color: #a7a7a7;
/*
------------------ INFIMA COMPONENTS (https://infima.dev/docs/components) ------------------
*/
/* ALERT (/alert) */
--ifm-alert-background-color: inherit;
--ifm-alert-border-color: inherit;
--ifm-alert-border-radius: var(--ifm-global-radius);
--ifm-alert-border-width: 0px;
--ifm-alert-border-left-width: 5px;
--ifm-alert-color: var(--ifm-font-color-base);
--ifm-alert-padding-horizontal: var(--ifm-spacing-horizontal);
--ifm-alert-padding-vertical: var(--ifm-spacing-vertical);
--ifm-alert-shadow: var(--ifm-global-shadow-lw);
/* AVATAR (/avatar) */
--ifm-avatar-intro-margin: 1rem;
--ifm-avatar-intro-alignment: inherit;
--ifm-avatar-photo-size-sm: 2rem;
--ifm-avatar-photo-size-md: 3rem;
--ifm-avatar-photo-size-lg: 4rem;
--ifm-avatar-photo-size-xl: 6rem;
/* BADGE (/badge) */
--ifm-badge-background-color: inherit;
--ifm-badge-border-color: inherit;
--ifm-badge-border-radius: var(--ifm-global-radius);
--ifm-badge-border-width: var(--ifm-global-border-width);
--ifm-badge-color: var(--ifm-color-white);
--ifm-badge-padding-horizontal: calc(var(--ifm-spacing-horizontal)*0.5);
--ifm-badge-padding-vertical: calc(var(--ifm-spacing-vertical)*0.25);
/* BREADCRUMBS (/breadcrumbs) */
--ifm-breadcrumb-border-radius: 1.5rem;
--ifm-breadcrumb-spacing: 0.0625rem;
--ifm-breadcrumb-color-active: var(--ifm-color-primary);
--ifm-breadcrumb-item-background-active: var(--ifm-hover-overlay);
--ifm-breadcrumb-padding-horizontal: 1rem;
--ifm-breadcrumb-padding-vertical: 0.5rem;
--ifm-breadcrumb-size-multiplier: 1;
--ifm-breadcrumb-separator: url('...');
--ifm-breadcrumb-separator-filter: none;
--ifm-breadcrumb-separator-size: 0.5rem;
--ifm-breadcrumb-separator-size-multiplier: 1.25;
/* BUTTON (/button) */
--ifm-button-background-color: inherit;
--ifm-button-border-color: var(--ifm-button-background-color);
--ifm-button-border-width: var(--ifm-global-border-width);
--ifm-button-font-weight: var(--ifm-font-weight-bold);
--ifm-button-padding-horizontal: 1.5rem;
--ifm-button-padding-vertical: 0.375rem;
--ifm-button-size-multiplier: 1;
--ifm-button-transition-duration: var(--ifm-transition-fast);
--ifm-button-border-radius: var(--ifm-button-size-multiplier);
--ifm-button-group-margin: 2px;
/* CARD (/card) */
--ifm-card-background-color: var(--ifm-background-surface-color);
--ifm-card-border-radius: calc(var(--ifm-global-radius)*2);
--ifm-card-horizontal-spacing: var(--ifm-global-spacing);
--ifm-card-vertical-spacing: var(--ifm-global-spacing);
/* DROPDOWN (/dropdown) */
--ifm-dropdown-background-color: var(--ifm-background-surface-color);
--ifm-dropdown-font-weight: var(--ifm-font-weight-semibold);
--ifm-dropdown-link-color: var(--ifm-font-color-base);
--ifm-dropdown-hover-background-color: var(--ifm-hover-overlay);
/* FOOTER (/footer) */
--ifm-footer-background-color: var(--ifm-color-emphasis-100);
--ifm-footer-color: inherit;
--ifm-footer-link-color: var(--ifm-color-emphasis-700);
--ifm-footer-link-hover-color: var(--ifm-color-primary);
--ifm-footer-link-horizontal-spacing: 0.5rem;
--ifm-footer-padding-horizontal: calc(var(--ifm-spacing-horizontal)*2);
--ifm-footer-padding-vertical: calc(var(--ifm-spacing-vertical)*2);
--ifm-footer-title-color: inherit;
/* HERO (/hero) */
--ifm-hero-background-color: var(--ifm-background-surface-color);
--ifm-hero-text-color: var(--ifm-color-emphasis-800);
/* NAVBAR (/navbar) */
--ifm-navbar-background-color: var(--ifm-background-surface-color);
--ifm-navbar-height: 3.75rem;
--ifm-navbar-item-padding-horizontal: 0.75rem;
--ifm-navbar-item-padding-vertical: 0.25rem;
--ifm-navbar-link-color: var(--ifm-font-color-base);
--ifm-navbar-link-active-color: var(--ifm-link-color);
--ifm-navbar-padding-horizontal: var(--ifm-spacing-horizontal);
--ifm-navbar-padding-vertical: calc(var(--ifm-spacing-vertical)*0.5);
--ifm-navbar-shadow: var(--ifm-global-shadow-lw);
--ifm-navbar-search-input-background-color: var(--ifm-color-emphasis-200);
--ifm-navbar-search-input-color: var(--ifm-color-emphasis-800);
--ifm-navbar-search-input-placeholder-color: var(--ifm-color-emphasis-500);
--ifm-navbar-search-input-icon: url('...');
--ifm-navbar-sidebar-width: 83vw;
/* PAGINATION NAV (/pagination-nav) */
--ifm-pagination-nav-border-radius: var(--ifm-global-radius);
--ifm-pagination-nav-color-hover: var(--ifm-color-primary);
/* PAGINATION (/pagination) */
--ifm-pagination-border-radius: var(--ifm-pagination-size-multiplier);
--ifm-pagination-color-active: var(--ifm-color-primary);
--ifm-pagination-font-size: 1rem;
--ifm-pagination-item-active-background: var(--ifm-hover-overlay);
--ifm-pagination-page-spacing: 0.0625rem;
--ifm-pagination-padding-horizontal: calc(var(--ifm-spacing-horizontal)*1);
--ifm-pagination-padding-vertical: calc(var(--ifm-spacing-vertical)*0.25);
--ifm-pagination-size-multiplier: 1;
/* PILLS (/pills) */
--ifm-pills-color-active: var(--ifm-color-primary);
--ifm-pills-color-background-active: var(--ifm-hover-overlay);
--ifm-pills-spacing: 0.0625rem;
/* TABS (/tabs) */
--ifm-tabs-color: var(--ifm-font-color-secondary);
--ifm-tabs-color-active: var(--ifm-color-primary);
--ifm-tabs-color-active-border: var(--ifm-tabs-color-active);
--ifm-tabs-padding-horizontal: 1rem;
--ifm-tabs-padding-vertical: 1rem;
--ifm-tabs-spacing: 0.0625rem;
/*
---------------------------- MISCELLANEOUS DOCUSAURUS VARIABLES ----------------------------
*/
--docusaurus-announcement-bar-height: auto;
--docusaurus-tag-list-border: var(--ifm-color-emphasis-300);
--docusaurus-details-summary-arrow-size: 0.38rem;
--docusaurus-details-transition: transform 200ms ease;
--docusaurus-details-decoration-color: grey;
--doc-sidebar-width: 300px;
--doc-sidebar-hidden-width: 30px;
}
/*
If you find a var that's not listed here, feel free to leave a comment. Also you can star the gist if it helped I won't get mad :P
*/
@heysokam
Copy link

Thank you so much for this. Crazy useful.
Can I ask how you created it? How did you find all of these variables?

@heysokam
Copy link

/**
 * @section Admonition Customization
 * @note Colors are taken from the main --ifm-color-** variables. These are the overrides to the Docusaurus defaults.
 */
.alert {
  &.alert--secondary {  /* Note Admonition */
    --ifm-alert-background-color-highlight : var(--ifm-color-primary-light);
    --ifm-alert-background-color           : var(--ifm-color-primary-darkest);
    --ifm-alert-foreground-color           : var(--ifm-color-primary-lightest);
    --ifm-alert-border-color               : var(--ifm-color-primary-dark);
  };
  &.alert--success {  /* Tip Admonition */
    --ifm-alert-background-color-highlight : var(--ifm-color-success-light);
    --ifm-alert-background-color           : var(--ifm-color-success-darkest);
    --ifm-alert-foreground-color           : var(--ifm-color-success-lightest);
    --ifm-alert-border-color               : var(--ifm-color-success-dark);
  };
  &.alert--info {  /* Info Admonition */
    --ifm-alert-background-color-highlight : var(--ifm-color-info-light);
    --ifm-alert-background-color           : var(--ifm-color-info-darkest);
    --ifm-alert-foreground-color           : var(--ifm-color-info-lightest);
    --ifm-alert-border-color               : var(--ifm-color-info-dark);
  };
  &.alert--warning {  /* Warning Admonition */
    --ifm-alert-background-color-highlight : var(--ifm-color-warning-light);
    --ifm-alert-background-color           : var(--ifm-color-warning-darkest);
    --ifm-alert-foreground-color           : var(--ifm-color-warning-lightest);
    --ifm-alert-border-color               : var(--ifm-color-warning-dark);
  };
  &.alert--danger {  /* Danger Admonition */
    --ifm-alert-background-color-highlight : var(--ifm-color-danger-light);
    --ifm-alert-background-color           : var(--ifm-color-danger-darkest);
    --ifm-alert-foreground-color           : var(--ifm-color-danger-lightest);
    --ifm-alert-border-color               : var(--ifm-color-danger-dark);
  };
};

@neoakris
Copy link

/docusaurus_website/src/css/custom.scss

[data-theme='dark'] { //<-- css selector of elements with a target attribute
  a.menu__link.menu__link--active { //currently selected left menu link
    background-color: #f3f6f4;
  }
  a.table-of-contents__link--active { //tracks current position on right hand ToC
    background-color: #f3f6f4;
  }
}

a.menu__link.menu__link--active { //currently selected left menu link
  background-color: #d8d8d89d;
}
a.table-of-contents__link--active { //tracks current position on right hand ToC
  background-color: #d8d8d89d;
}

^-- This is also handy. (I discovered these using chrome debug mode) (since it's a highlight I adjust it for light and dark mode)
If you want to see what it's doing just visit guidescape.org

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment