# GlassMarshmallow documentation # Introduction GlassMarshmallow is a CSS framework with glass surfaces, light and dark mode and WCAG 2.2 AA accessibility (and AAA whenever possible) from the first component. > **GlassMarshmallow is in development (v0.1).** The docs grow page by page together with the framework. ## What's included - **Design tokens**: colors (the pastel palette with its scales), type, radii, shadows and glass as CSS custom properties with the `--gm-` prefix. - **Base styles**: text, headings, an always-visible focus, the skip link and AAA accessibility rules built in. - **Layout**: containers, breakpoints and a 12-column grid. - **Components**: buttons, cards, alerts, tags, accordion, carousel, gallery, avatar, menu, search, tooltip, video player, progress bar, navbar and mobile tab bar. - **Forms**: fields, segmented control, range, date picker, color picker and the rules for good forms. - **Utilities** in the Tailwind style: spacing, sizing, borders, shadows, glass effects, animations, flex and display. - **Optional scripts**, with no dependencies, for components that move (menu, calendar, carousel, player…). - **Icons**: in their own package, [GlassMarshmallow Icons](/icons), with the same names as Bootstrap Icons. ## Quick start Copy this page to start. It loads GlassMarshmallow and sets the color mode with `data-theme` on ``. ```html Hello, GlassMarshmallow

Hello, world!

``` ## Accessibility Every component meets **WCAG 2.2 AA** in light and dark mode, and almost everything reaches **AAA**: text reaches 7:1, everything you can press is 44 px, focus is always visible and everything works with the keyboard alone. More in [Accessibility](/docs/getting-started/accessibility). ## Next steps - [Install GlassMarshmallow](/docs/getting-started/install) with a package manager or from a CDN. - Read the framework's [approach](/docs/getting-started/approach) and the [user experience guides](/docs/guides/ux). - Try the [tools](/tools): glass, gradient, filter and palette generators, and the TV effect. # Install Use a package manager, a CDN or the source files to add GlassMarshmallow to your project. > **Not published yet.** GlassMarshmallow v0.1 is still in development, so the npm package and the CDN links below don't work yet. They show how installing will work once it's released. ## Package managers Install the GlassMarshmallow CSS with your package manager of choice. ```sh:npm npm install glassmarshmallow ``` ```sh:pnpm pnpm add glassmarshmallow ``` ```sh:Yarn yarn add glassmarshmallow ``` ```sh:Bun bun add glassmarshmallow ``` ### Using the CSS Link the compiled file in your HTML, or import it from your own CSS. ```html:HTML ``` ```css:CSS @import "glassmarshmallow/dist/css/glassmarshmallow.css"; ``` If you only need some parts, import the source files one by one. `tokens.css` always goes first. ```css @import "glassmarshmallow/css/tokens.css"; @import "glassmarshmallow/css/base.css"; @import "glassmarshmallow/css/components.css"; @import "glassmarshmallow/css/backdrop.css"; ``` ## Icons The icons live in their own package, [GlassMarshmallow Icons](/icons). ```sh:npm npm install glassmarshmallow-icons ``` ```sh:pnpm pnpm add glassmarshmallow-icons ``` ```sh:Yarn yarn add glassmarshmallow-icons ``` ```sh:Bun bun add glassmarshmallow-icons ``` Then load the stylesheet and use an icon with two classes. Icons take the color of the text around them. ```html ``` ## CDN Skip the install and load the compiled CSS from a CDN. ```html ``` ## Download Download the source code from the [repository on GitHub](https://github.com/GlassMarshmallow/glassmarshmallow). The ready-to-use files are in `dist/css/` and the source files in `css/`. To build `dist/` again after changing the source: ```sh npm run css ``` ## For AI tools & LLMs GlassMarshmallow will come with files that help AI assistants write correct code with the framework: - **`llms.txt`**: a short map of the docs for language models. - **`AGENTS.md`**: the rules for agents working in the repository. - **Skills**: ready-made instructions for common tasks. Read more in [AI](/docs/getting-started/ai). # AI GlassMarshmallow is ready for AI assistants (Claude, ChatGPT, Copilot…) to use it well: they have the documentation in a format they understand and step-by-step guides for the most common tasks. ## Documentation for AI | File | What it is | | --- | --- | | [`/llms.txt`](/llms.txt) | The index: what GlassMarshmallow is and the list of every page with one sentence each | | [`/llms-full.txt`](/llms-full.txt) | All the documentation in a single text file | They follow the [llms.txt](https://llmstxt.org) format. They are generated from this documentation every time the site is published, so they are always up to date. To use them, give your assistant the address: “Read https://…/llms-full.txt and build me a contact form with GlassMarshmallow”. ## Skills Step-by-step guides that teach an assistant to do specific tasks with GlassMarshmallow. They live in the repository's `skills/` folder: | Skill | For | | --- | --- | | `install` | Add GlassMarshmallow to a project: CSS, icons, Montserrat, color mode and scripts | | `customize-colors` | Change colors in light and dark mode without losing contrast | | `create-component` | Add a new component to the framework with its design and accessibility rules | With Claude Code, copy the skill folder into your project's `.claude/skills/` and it will be used when needed. ## AGENTS.md The repository has an `AGENTS.md` file with the rules for agents working on the framework itself: where everything is, what must not be edited by hand, the accessibility to meet and how commits are named. ## What to ask for - To use **only GlassMarshmallow classes and variables** (`gm-…`, `--gm-…`) and its icons (`gmi`), without inventing colors. - To check **contrast in light and dark mode** and that everything works with the keyboard. - To follow the [user experience guides](/docs/guides/ux) and the [form rules](/docs/forms/rules). # Approach The ideas behind GlassMarshmallow that guide every decision. If you are going to use it or add to it, start here. ## Glass and pastel GlassMarshmallow's look comes from two things: **glass surfaces** (translucent background, blur and a thin border) and a **pastel palette** of 8 colors, plus black, white and grays. Everything else is restrained: Montserrat, light backgrounds by day and black at night, and a single accent color: pink by day and blue at night. ## Designs from real projects Every component comes from a project that already exists and works: the portfolio, My Book Box or My MTV Box. Styles are not invented: they are taken from there, adjusted to be accessible and added to the framework so all projects share them. ## Accessible from the start - **WCAG 2.2 AA always**, in light and dark mode, and **AAA whenever possible**: 7:1 text, 44 px targets, visible and unobscured focus. - It is checked with axe and by measuring contrast on the real pixels, not by eye. - What cannot be made accessible does not go in. ## Light and dark, with the same care Every color is a variable that changes with `data-theme`. Dark mode is not light mode inverted: it has its own tones so everything reads just as well. ## Mobile first Unprefixed classes apply to every screen and prefixed ones (`gm-md-…`) are added from a [breakpoint](/docs/layout/breakpoints) upwards. On phones the navbar moves to the bottom tab bar. ## Components and utilities - **Components**, like Bootstrap: ready-made pieces with one class (`.gm-btn`, `.gm-accordion`). - **Utilities**, like Tailwind: small classes to adjust without writing CSS (`gm-mt-4`, `gm-shadow-md`). - They combine: a component tweaked with utilities. ## Plain CSS, optional JavaScript - The framework is **plain CSS**: no Sass, no build step, no extra packages. - Components that move (menu, calendar, carousel…) have an **optional script** with no dependencies. Without it, the component still shows and, whenever possible, works in a basic way. ## Names - Everything starts with **`gm-`**: classes (`.gm-btn`) and variables (`--gm-accent`). That way it does not clash with other libraries. - Components follow the **BEM** pattern: block, element and modifier (`.gm-player__button--main`). - Sizes are **relative** (`rem`, `em`, `%`) so everything grows with the person's text size. ## Own icons Only [GlassMarshmallow Icons](/icons), with the same names as Bootstrap Icons. No emojis and no icons mixed in from other sets. # CSS variables All of GlassMarshmallow's look comes from CSS variables with the `--gm-` prefix. They change on their own with light and dark mode (`data-theme`), and you can change them for the whole site or for just one part. ## Changing a variable In `:root` for the whole site, in `[data-theme="dark"]` for dark mode, or on any element to change it only inside it: ```html-code ``` If you change a color, check the contrast afterwards (7:1 for text, 3:1 for borders and icons). These are the main ones. The pastel palette and its scales are in [Palette](/docs/color/colors). ## Page and text | Variable | Light | Dark | | --- | --- | --- | | `--gm-bg` | `#f5f5f7` | `#000` | | `--gm-text` | `#1d1d1f` | `#f5f5f7` | | `--gm-text-secondary` | `#3a3a3c` | `#d1d1d6` | | `--gm-muted` | `#48484a` | `#b8b8bc` | | `--gm-link` | `#004b96` | `#79beff` | | `--gm-link-hover` | `#004b96` | `#79beff` | | `--gm-selection` | `rgba(255, 166, 209, .45)` | `rgba(138, 180, 255, .35)` | | `--gm-font` | `"Montserrat", -apple-system, BlinkMacSystemFo…` | same | | `--gm-font-mono` | `ui-monospace, SFMono-Regular, Menlo, monospace` | same | ## Surfaces and lines | Variable | Light | Dark | | --- | --- | --- | | `--gm-surface` | `rgba(255, 255, 255, .82)` | `rgba(28, 28, 30, .82)` | | `--gm-surface-solid` | `#fff` | `#1c1c1e` | | `--gm-surface-glass` | `rgba(255, 255, 255, .86)` | `rgba(44, 44, 46, .86)` | | `--gm-surface-glass-border` | `rgba(255, 255, 255, .8)` | `rgba(255, 255, 255, .06)` | | `--gm-surface-soft` | `rgba(255, 255, 255, .6)` | `rgba(44, 44, 46, .6)` | | `--gm-line` | `rgba(0, 0, 0, .08)` | `rgba(255, 255, 255, .1)` | | `--gm-line-strong` | `#bbb` | `#545458` | | `--gm-hover` | `rgba(0, 0, 0, .05)` | `rgba(255, 255, 255, .08)` | | `--gm-tag` | `#e8e8ed` | `#2c2c2e` | | `--gm-tag-hover` | `#dcdce1` | `#3a3a3c` | | `--gm-fill-subtle` | `rgba(0, 0, 0, .025)` | `rgba(255, 255, 255, .04)` | ## Accent and buttons | Variable | Light | Dark | | --- | --- | --- | | `--gm-accent` | `#c71c6f` | `#8ab4ff` | | `--gm-accent-strong` | `#940061` | `#003290` | | `--gm-accent-hover` | `#700148` | `#00236b` | | `--gm-focus` | `#c71c6f` | `#8ab4ff` | | `--gm-primary` | `#1d1d1f` | `#f5f5f7` | | `--gm-on-primary` | `#fff` | `#1d1d1f` | ### Another accent color The accent is the color of accent buttons, keyboard focus, fields while typing, sliders and checkboxes. To change it for the whole site, give a value for each mode. For example, in lavender: ```html-code ``` This is how it looks (with the day values): ```html
``` Check the contrast: the accent on the background, 3:1 at least (4.5:1 if you use it for text); white text on `--gm-accent-strong`, 7:1. ## States | Variable | Light | Dark | | --- | --- | --- | | `--gm-success` | `var(--gm-mint-900)` | `var(--gm-mint)` | | `--gm-success-bg` | `var(--gm-mint-050)` | `rgb(var(--gm-mint-rgb) / .15)` | | `--gm-warning` | `var(--gm-lemon-800)` | `var(--gm-lemon)` | | `--gm-warning-bg` | `var(--gm-lemon-050)` | `rgb(var(--gm-lemon-rgb) / .15)` | | `--gm-danger` | `var(--gm-coral-800)` | `var(--gm-coral)` | | `--gm-danger-bg` | `var(--gm-coral-050)` | `rgb(var(--gm-coral-rgb) / .15)` | ## Fields | Variable | Light | Dark | | --- | --- | --- | | `--gm-field-bg` | `#f5f5f7` | `#1d1d1f` | | `--gm-field-bg-focus` | `#fff` | `#1d1d1f` | | `--gm-field-border` | `#86868b` | `#6e6e73` | | `--gm-field-focus` | `#c71c6f` | `#8ab4ff` | | `--gm-field-ring` | `rgba(14, 116, 144, .15)` | `rgba(28, 171, 176, .45)` | | `--gm-form-bg` | `rgba(255, 255, 255, .78)` | `rgba(255, 255, 255, .04)` | ## Shapes, shadows and glass | Variable | Light | Dark | | --- | --- | --- | | `--gm-radius-sm` | `12px` | same | | `--gm-radius-md` | `20px` | same | | `--gm-radius-lg` | `30px` | same | | `--gm-radius-pill` | `999px` | same | | `--gm-shadow-sm` | `0 2px 12px rgba(0, 0, 0, .05)` | `0 2px 12px rgba(0, 0, 0, .4)` | | `--gm-shadow-md` | `0 18px 50px rgba(0, 0, 0, .11)` | `0 18px 50px rgba(0, 0, 0, .6)` | | `--gm-shadow-hover` | `0 8px 22px rgba(0, 0, 0, .18)` | `0 8px 22px rgba(0, 0, 0, .5)` | | `--gm-blur` | `20px` | same | | `--gm-blur-header` | `24px` | same | ## Layout | Variable | Light | Dark | | --- | --- | --- | | `--gm-container` | `1240px` | same | | `--gm-header-height` | `72px` | same | | `--gm-breakpoint-sm` | `600px` | same | | `--gm-breakpoint-md` | `860px` | same | | `--gm-breakpoint-lg` | `1100px` | same | | `--gm-breakpoint-xl` | `1300px` | same | # Accessibility GlassMarshmallow follows **WCAG 2.2 at level AA** in light and dark mode, the level asked for by European and Spanish law, and also meets the AAA criteria for contrast, presentation, focus and target size. These are all the rules, grouped by the four principles of WCAG, with how the framework meets each one. > The complete list, with the 86 criteria of levels A, AA and AAA, is in [All the rules (WCAG 2.2)](/docs/getting-started/wcag). > **The framework helps, but it does not do everything.** Your content (texts, images, names of buttons, order of the headings) also has to follow these rules. ## Perceivable Everyone can see or hear the content. | Criterion | Level | Rule | In GlassMarshmallow | | --- | --- | --- | --- | | 1.1.1 | A | Every image that gives information has a text alternative (`alt`). Decorative images and icons have `alt=""` or `aria-hidden="true"`. | Icons (`.gmi`) are decorative: they always go with `aria-hidden="true"`. | | 1.3.1 | A | The structure is in the HTML: headings, lists, tables, labels and regions (`header`, `main`…). | See [Page structure](/docs/content/structure). Every field has its `