0.2.0 • Published 3 months ago

quolor v0.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

Quolor

A simple library to apply colors from the query string to the page.

Usage

import { quolor } from 'quolor';

quolor(document);

Custom Rules

import { quolor, Binding } from 'quolor';

const rules: Binding[] = [
  {
    type: 'text',
    css: '--query-color-text',
    query: 'color-text',
    elements: ['p', 'a'],
  },
  {
    type: 'background',
    css: '--query-color-bg',
    query: 'color-bg',
    specialElements: ['html'],
  },
];

quolor(document, rules);

Default Rules

{
    type: 'text',
    css: '--query-color-text',
    query: 'color-text',
    elements: ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p'],
},
{
    type: 'background',
    css: '--query-color-bg',
    query: 'color-bg',
    specialElements: ['html'],
},