Mastodon
  • What is Mastodon?
  • Using Mastodon
    • Signing up for an account
    • Setting up your profile
    • Posting to your profile
    • Using the network features
    • Quoting other posts
    • Dealing with unwanted content
    • Promoting yourself and others
    • Set your preferences
    • More settings
    • Using Mastodon externally
    • Moving or leaving accounts
    • Official iOS and Android apps
    • Running your own server
  • Running Mastodon
    • Preparing your machine
    • Installing from source
    • Configuring your environment
    • Configuring full-text search
    • Installing optional features
      • Object storage
      • Onion services
      • Captcha
      • Single Sign On
    • Setting up your new instance
    • Using the admin CLI
    • Upgrading to a new release
    • Backing up your server
    • Migrating to a new machine
    • Scaling up your server
    • Moderation actions
    • Troubleshooting errors
      • Database index corruption
    • Webhooks
    • Roles
  • Developing Mastodon apps
    • Getting started with the API
    • Playing with public data
    • Obtaining client app access
    • Logging in with an account
    • Libraries and implementations
    • Implementing quote posts
  • Contributing to Mastodon
    • Technical overview
    • Setting up a dev environment
    • Code structure
    • Routes
    • Security issues and responsible disclosure
    • Frontend guide
      • Components
      • State management
      • CSS and styling
      • Creating themes
      • Design tokens reference
  • Spec compliance
    • ActivityPub
    • WebFinger
    • Security
    • Microformats
    • OAuth
    • Bearcaps
  • REST API
    • Datetime formats
    • Guidelines and best practices
    • OAuth Tokens
    • OAuth Scopes
    • Rate limits
  • API Methods
    • accounts
      • blocks
      • bookmarks
      • domain_blocks
      • endorsements
      • favourites
      • featured_tags
      • filters
      • follow_requests
      • followed_tags
      • mutes
      • preferences
      • reports
      • suggestions
      • tags
    • admin
      • accounts
      • canonical_email_blocks
      • dimensions
      • domain_allows
      • domain_blocks
      • email_domain_blocks
      • ip_blocks
      • measures
      • reports
      • retention
      • trends
    • apps
      • emails
      • oauth
    • async_refreshes
    • collections
    • grouped notifications
    • health
    • instance
      • announcements
      • custom_emojis
      • directory
      • trends
    • notifications
      • push
    • oembed
    • profile
    • proofs
    • search
    • statuses
      • media
      • polls
      • scheduled_statuses
    • timelines
      • conversations
      • lists
      • markers
      • streaming
  • API Entities
    • Account
    • AccountWarning
    • Admin::Account
    • Admin::CanonicalEmailBlock
    • Admin::Cohort
    • Admin::Dimension
    • Admin::DomainAllow
    • Admin::DomainBlock
    • Admin::EmailDomainBlock
    • Admin::Ip
    • Admin::IpBlock
    • Admin::Measure
    • Admin::Report
    • Announcement
    • Appeal
    • Application
    • AsyncRefresh
    • Collection
    • CollectionItem
    • CollectionWithAccounts
    • Context
    • Conversation
    • CustomEmoji
    • DomainBlock
    • Error
    • ExtendedDescription
    • FamiliarFollowers
    • FeatureApproval
    • FeaturedTag
    • Filter
    • FilterKeyword
    • FilterResult
    • FilterStatus
    • IdentityProof
    • Instance
    • List
    • Marker
    • MediaAttachment
    • Notification
    • NotificationFallback
    • NotificationPolicy
    • NotificationRequest
    • Poll
    • Preferences
    • PreviewCard
    • PreviewCardAuthor
    • PrivacyPolicy
    • Profile
    • Quote
    • QuoteApproval
    • Reaction
    • Relationship
    • RelationshipSeveranceEvent
    • Report
    • Role
    • Rule
    • ScheduledStatus
    • Search
    • ShallowQuote
    • ShallowTag
    • Status
    • StatusEdit
    • StatusSource
    • Suggestion
    • Tag
    • TermsOfService
    • Token
    • Translation
    • V1::Filter
    • V1::Instance
    • V1::NotificationPolicy
    • WebPushSubscription

Design tokens reference

An overview of the design tokens introduced in Mastodon 4.6

    • What are design tokens?
    • General structure
    • Reference
      • Text tokens
      • Background tokens
      • Border tokens
      • Other legacy tokens

What are design tokens?

Design tokens are colour, size, or other design values with names that reflect the intended usage of the token. Each token represents a small design decision, helping you choose values that are consistent with similar usages of values already present in our UI.

As of Mastodon 4.6, we’ve only introduced theme tokens, i.e. those related to theme colours. Additional tokens for spacing, font sizes, and more are planned to be added later.

Our theme tokens are defined in app/javascript/styles/mastodon/theme.

General structure

Theme tokens look like this: --color-text-primary or --color-bg-brand-soft.

The first part of each token name indicates the type of the token’s value, e.g. color.

The second part of the name matches one of three categories, indicating where the token is meant to be used:

  • -text
  • -bg (background)
  • -border

The next part of the token name further groups the token into a semantic role or context, e.g. -primary, -brand, -error, -on-brand-base.

Finally, sometimes additional modifiers are added to the token name, e.g. most background tokens follow a consistent -base, -soft, -softest pattern.

Reference

Text tokens

TokenPurpose
--color-text-primaryMain text color for body content and standard UI text
--color-text-secondarySlightly muted text for supporting copy and metadata
--color-text-tertiaryMuted text for less prominent content (legacy)
--color-text-invertedText on inverted backgrounds, e.g. toast notifications
--color-text-brandBranded color for highlighted or interactive text
--color-text-brand-softSoft brand color for subtle branded text (legacy)
--color-text-on-brand-baseText color when placed over solid ‘brand’ background
--color-text-brand-on-invertedBranded text color when placed on inverted background (legacy)
--color-text-errorText indicating errors or destructive actions
--color-text-on-error-baseText color when placed over solid ’error’ background
--color-text-warningText indicating warnings
--color-text-on-warning-baseText color when placed over solid ‘warning’ background
--color-text-successText indicating success, e.g. valid user input
--color-text-on-success-baseText color when placed over solid ‘success’ background
--color-text-disabledText for disabled controls (legacy)
--color-text-on-disabledText when placed over ‘disabled’ background (legacy)
--color-text-bookmark-highlightIcon color for the selected ‘bookmark’ action (legacy)
--color-text-favourite-highlightIcon color for the selected ‘favourite’ action (legacy)
--color-text-on-mediaText when placed in the media modal (legacy)
--color-text-status-linksLink color in posts (legacy)

Background tokens

Neutral backgrounds

TokenPurpose
--color-bg-primaryPrimary background for main content areas
--color-bg-secondarySecondary background for subtle surface differentiation
--color-bg-tertiaryTertiary background for stronger surface differentiation (legacy)

Utility backgrounds

TokenPurpose
--color-bg-invertedBackground for inverted contexts (relative to primary background)
--color-bg-overlay-baseDark overlay for dialogs and backdrops
--color-bg-overlay-highlightLight overlay for subtle hover states
--color-bg-overlaySolid overlay for modal dialog backdrop (legacy)
--color-bg-mediaSlightly transparent background for elements overlaid on top of media (legacy)
--color-bg-media-baseOpaque base colour of the token above (legacy)
--color-bg-disabledSolid background for disabled controls, e.g. disabled primary buttons (legacy)

Brand backgrounds

TokenPurpose
--color-bg-brand-baseOpaque brand color for primary buttons and similar controls
--color-bg-brand-base-hoverSlight variant of the above for hover effects (legacy)
--color-bg-brand-softSoftly tinted background for highlighted content
--color-bg-brand-softestMore subtly tinted background for highlighted content

Error backgrounds

TokenPurpose
--color-bg-error-baseOpaque error color for destructive buttons
--color-bg-error-base-hoverSlight variant of the above for hover effects (legacy)
--color-bg-error-softSoftly tinted background for error content
--color-bg-error-softestMore subtly tinted background for error content

Warning backgrounds

TokenPurpose
--color-bg-warning-baseOpaque warning color for buttons (legacy)
--color-bg-warning-softSoftly tinted background for warning content
--color-bg-warning-softestMore subtly tinted background for warning content

Success backgrounds

TokenPurpose
--color-bg-success-baseOpaque success color for buttons (legacy)
--color-bg-success-softSoftly tinted background for success content
--color-bg-success-softestMore subtly tinted background for success content

Border tokens

TokenPurpose
--color-border-primaryPrimary color for borders and separators
--color-border-brandBrand color for borders and outlines on interactive content
--color-border-brand-softSoft brand color for borders around highlighted content
--color-border-errorBorder color for interactive content with errors
--color-border-success-softBorder color for verified link cards
--color-border-warning-softBorder color for warning callouts (legacy)
--color-border-error-softBorder color for error callouts (legacy)
--color-border-mediaSubtle border for embedded post media (images and videos) (legacy)

Other legacy tokens

The following tokens will not be used in new designs, but still exist to support older UI elements.

Shadow tokens (legacy)

TokenPurpose
--dropdown-shadowStandard box-shadow value for dropdown menus
--overlay-icon-shadowShadow filter value for icons overlaid on media

Tokens for graphs and charts (legacy)

TokenPurpose
--color-graph-primary-strokeStandard colour for shape outlines in charts
--color-graph-primary-fillStandard colour for shape fills in charts
--color-graph-warning-strokeWarning colour for shape outlines in charts
--color-graph-warning-fillWarning colour for shape fills in charts
--color-graph-disabled-strokeColour for shape outlines in disabled charts
--color-graph-disabled-fillColor for shape fills in disabled charts

Tokens for rich text formatting (legacy)

TokenPurpose
--rich-text-container-colorBackground colour for code or inline quotes embedded in posts
--rich-text-text-colorText colour for code or inline quotes embedded in posts
--rich-text-decorations-colorIcon colour shown on inline quotes embedded in posts

Last updated May 29, 2026 · Improve this page

Sponsored by

Dotcom-Monitor LoadView Stephen Tures Swayable SponsorMotion

Join Mastodon · Blog ·

View source · CC BY-SA 4.0 · Imprint