Svelte Themes

screenshot of Svelte Themes
svelte

Svelte Themes

Perfect SvelteKit dark mode in 2 lines of code. Support System preference and any other theme with no flashing

Overview

This library is a port of next-theme for SvelteKit. It provides an abstraction for themes in your SvelteKit.js app. The library provides various features to make theme handling easy and customizable, including perfect dark mode, system setting with prefers-color-scheme, themed browser UI, and more. It is still in the early phase, and contributions are welcome.

Features

  • Perfect dark mode in 2 lines of code: Easily enable dark mode for your app.
  • System setting with prefers-color-scheme: Automatically switch between dark and light based on the user's system preference.
  • Themed browser UI with color-scheme: Indicate to browsers which color scheme is used for built-in UI elements like inputs and buttons.
  • No flash on load: Prevent any flashing on page load when switching themes.
  • Sync theme across tabs and windows: Ensure that the selected theme remains consistent across different tabs and windows.
  • Disable flashing when changing themes: Disable any flashing effect that occurs during a theme switch.
  • Force pages to specific themes: Set a forced theme for a specific page that overrides saved theme settings.
  • Class or data attribute selector: Modify the HTML attribute based on the active theme, allowing you to apply theme-specific styles using either class or data attribute selectors.
  • Theme store: Access the theme props anywhere in your app using the theme writable store and easily switch themes.
svelte
Svelte

Svelte is a modern front-end framework that compiles your code at build time, resulting in smaller and faster applications. It uses a reactive approach to update the DOM, allowing for high performance and a smoother user experience.

template
Templates & Themes

A template or theme refers to a pre-designed layout or structure that provides a basic framework for building a specific type of application or website. It typically includes good design, placeholder content and functional features, allowing developers to customize and fill in the details according to their specific needs.

Dark Mode

Dark mode is a user interface option that uses a dark color scheme instead of light. It reduces eye strain and improves visibility in low-light conditions. Implementing dark mode in a website or application involves updating the styles and color palette to support both light and dark modes.

eslint
Eslint

ESLint is a linter for JavaScript that analyzes code to detect and report on potential problems and errors, as well as enforce consistent code style and best practices, helping developers to write cleaner, more maintainable code.

typescript
Typescript

TypeScript is a superset of JavaScript, providing optional static typing, classes, interfaces, and other features that help developers write more maintainable and scalable code. TypeScript's static typing system can catch errors at compile-time, making it easier to build and maintain large applications.