New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

svelte-color-mode

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

svelte-color-mode

SSR-compatible, flash-free Svelte components for defining and switching between different color modes.

0.1.4
unpublished
latest
Source
npm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Svelte Color Mode

Svelte Color Mode

NPM version Netlify Status pre-commit.ci status

Live Demo

SSR-compatible, flash-free, localStorage-persisted color mode + multiple Svelte UI components for selecting current color mode.

Installation

yarn add -D svelte-color-mode

Usage

In a SvelteKit project:

<script>
  import { ColorMode, ColorPicker } from 'svelte-color-mode'

  const colorsByMode = {
    light: {
      textColor: `black`,
      linkColor: 'darkblue',
      hoverColor: 'darkorange',
      bodyBg: `white`,
    },
    dark: {
      textColor: `white`,
      linkColor: 'cornflowerblue',
      hoverColor: 'orange',
      bodyBg: '#061725',
    },
  }
</script>

<ColorMode {colorsByMode} />

For more docs, check out the live demo.

Want to contribute?

At present, svelte-color-mode contains just a few UI components for changing the color mode, all under src/lib/*ColorPicker.svelte. More are welcome. If you have a good idea for a color mode UI and would like to contribute it, please do! Implementation-wise, all it takes is to import the colorMode store (see stores.ts) and change its value based on user input.

To submit a PR, clone the repo, install dependencies and start the dev server to try out your changes.

git clone https://github.com/janosh/svelte-color-mode
cd svelte-color-mode
yarn
yarn dev

Examples

Used in production on these sites:

Keywords

svelte

FAQs

Package last updated on 08 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts