1.0.8 • Published 10 months ago

@supersoniks/duotone v1.0.8

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

Installation

ssks yarn add @supersoniks/duotone

Init

import Duotone from '@supersoniks/duotone';
const duotone = new Duotone({
  filters: [
    {
      id: 'duotone_default', 
      dark: '--duotone-default-dark', 
      light: '--duotone-default-light'
    },
  ]
});

Options

PropertyTypeDefaultDescription
idstring"ssks_duotone_container"The id of the svg element built in the parent filters template
rootStylecomputed stylegetComputedStyle(document.body)the DOM element to get css_vars from
filtersArray[]An array of filter ojects
$parentFiltersDOM elementnullSVG element that will get the filters appened to. Eg : document.querySelector('#ssks_duotone defs')
generateStyleSheetBooleantrueGenerate a style sheet for elements with the attribude "data-duotone"

Filter Options

PropertyTypeDefaultDescription
idstring""The id of the filter
darkstring""Define the dark tone, css custom property
lightstring""Define the light tone, css custom property
rootStylecomputed stylegetComputedStyle(document.body)the DOM element to get css_vars from

Methods

addFilter

Add a filter to the DOM after a new Duotone has been initialized

const duotone = new Duotone();
duotone.addFilter({
  id: 'green_duotone', 
  dark: '--bichro-red-dark', 
  light: '--bichro-red-light',
  rootStyle: getComputedStyle(document.querySelector('.site-header')),
});
1.0.8

10 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago