Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • CSS Tutorial
  • CSS Exercises
  • CSS Interview Questions
  • CSS Selectors
  • CSS Properties
  • CSS Functions
  • CSS Examples
  • CSS Cheat Sheet
  • CSS Templates
  • CSS Frameworks
  • Bootstrap
  • Tailwind
  • CSS Formatter
Open In App
Next Article:
Primer CSS States
Next article icon

Primer CSS Theming Set Theme

Last Updated : 07 Nov, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and colour. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by Object-Oriented CSS principles, functional CSS, and BEM architecture. It is highly reusable and flexible. It is created with GitHub’s design system.

We will study Primer CSS theming in this tutorial. Primer CSS provides a variety of colour schemes for elements and tools. Depending on the active theme and colour mode, the website's colour will change. The website has a light theme by default.

Primer CSS Data attributes:

Themedata attributes
Lightdata-color-mode="light" data-light-theme="light"
Darkdata-color-mode="dark" data-dark-theme="dark"
Dark Dimmeddata-color-mode="dark" data-dark-theme="dark_dimmed"
Dark High Contrastdata-color-mode="dark" data-dark-theme="dark_dimmed_contrast"
 

Syntax:

<html data-color-mode="dark" data-dark-theme="dark_dimmed_contrast">

Example1: In the example that follows, we'll simply add the property to the document root element to switch the theme of the website to the light mode.

HTML
<!DOCTYPE html> <html data-color-mode="light"        data-dark-theme="light">  <head>     <title>Primer CSS | Light Theme</title>     <link rel="stylesheet" href= "https://unpkg.com/@primer/css@^18.0.0/dist/primer.css" /> </head>  <body>     <center>         <div class="m-4">             <h1 class="color-fg-success"> Themer settings </h1>             <h3>Primer CSS | Light Theme</h3>         </div>         <div class="container-lg clearfix">             <div>                 <h2><b>What is Themer settings?.</b></h2> <br><br>                 <h4>We have to provide a variety of services for                        you to learn, for Tutorials, Millions of Articles,                     Live, Online and Classroom Courses, Frequent                     Coding Competitions, Webinars by Industry Experts,                       Internship opportunities and Job Opportunities                     Knowledge</h2>             </div>         </div>     </center> </body>  </html> 

Output:

 

Example2: In the example that follows, we'll simply add the property to the document root element to switch the theme of the website to Dark mode.

HTML
<!DOCTYPE html> <html data-color-mode="dark"        data-dark-theme="dark">  <head>     <title>Primer CSS | Dark Theme</title>     <link rel="stylesheet" href= "https://unpkg.com/@primer/css@^18.0.0/dist/primer.css" /> </head>  <body>     <center>         <div class="m-4">             <h1 class="color-fg-success"> Themer settings </h1>             <h3>Primer CSS | Dark Theme</h3>         </div>         <div class="container-lg clearfix">             <div>                 <h2><b>What is Themer settings?.</b></h2> <br><br>                 <h4>We have to provide a variety of services for                        you to learn, for Tutorials, Millions of Articles,                     Live, Online and Classroom Courses, Frequent                     Coding Competitions, Webinars by Industry Experts,                       Internship opportunities and Job Opportunities                     Knowledge</h2>             </div>         </div>     </center> </body>  </html> 

Output:

 

Reference: https://primer.style/css/support/theming


Next Article
Primer CSS States

N

narendrapekbcf
Improve
Article Tags :
  • Web Technologies
  • CSS

Similar Reads

  • Primer CSS Theming
    Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and colour. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by
    3 min read
  • Primer CSS Theming Sync to the System
    Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. It is created with GitHub’s design system. In this article, we will see Primer CSS Theming Sync to the System. To sync the theme of
    2 min read
  • Primer CSS States
    Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by
    2 min read
  • Primer CSS Spacing Scale
    Primer CSS is a free open-source CSS framework based on technologies that provide insights into important style aspects like space, font, and color. This meticulous methodology ensures that its patterns are both stable and compatible. It's mostly practical and adaptable. It was created using the Git
    3 min read
  • Primer CSS Spacing
    Primer CSS is a free open-source CSS framework that is built with the GitHub design system to provide support to the broad spectrum of Github websites. It creates the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are ste
    4 min read
  • Primer CSS Box Row Themes
    Primer CSS Box is a container that has a white-colored background, rounded corners, and a grey border on all four sides. In this article, we will be seeing Primer CSS Box Row Themes. The background color of each row in a box can be changed individually. We can also specify the row color on hover or
    3 min read
  • Primer CSS Typographic Styles
    Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by
    3 min read
  • Primer CSS Typography Type Scale
    Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by
    2 min read
  • Primer CSS Subhead
    Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by
    2 min read
  • Primer CSS Blue Box Theme
    Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences