Skip to content

Releases: gnomical/solid-theme-provider

Security Update

02 Jul 01:39
1e7ffa5
Compare
Choose a tag to compare

Updating packages to resolve CVE-2024-4068 (Uncontrolled resource consumption in braces < 3.0.3)

more info

Custom Variants

22 Jan 03:17
a3e20c3
Compare
Choose a tag to compare

In addition to the default variables this package also detects hex colors (e.g. #FFFFFF) and auto calculates complementary transparent versions for use throughout your project.

That behavior can now be overridden by passing a custom function to the calculate_variants prop.

The function will be provided the name and value of each variable in the current theme. The ThemeProvider expects an object returned which contains the variants of the key/value pairs that make up the css variables you want added to the root element of the dom.

E.g.

const calculate_variants = (name: string, value: string) => {
  // if the current value is a hex color
  // add complementary transparencies
  let pattern = /^#[0-9A-F]{6}$/i;
  if (value.match(pattern)) {
    return {
      [name + "-alpha_primary"]: value + "f2", // 95%
      [name + "-alpha_secondary"]: value + "99", // 60%
      [name + "-alpha_tertiary"]: value + "4d", // 30%
      [name + "-alpha_quaternary"]: value + "17", // 9%
    };
  }
  return {};
};

Security Update and Bugfix

27 Oct 03:10
6b4f3eb
Compare
Choose a tag to compare
  • Fixes CVE-2023-45133
  • corrects typo "quaternary" and continues to allow "quarternary" for backward compatibility.

'browser_theme_color' exposed as css variable

11 Oct 01:14
c194fef
Compare
Choose a tag to compare
  • Includes the "browser_theme_color" property of the config as a css variable at run time.
  • Also fixes the PostCSS line return parsing error as reported by dependabot

Enable Extending Functionality

10 Sep 02:33
3f8452e
Compare
Choose a tag to compare

currentTheme and setTheme are now exposed for applications that wish to extend the functionality of this component

// Example of passing a string of the theme name to a 3rd party component
import { ThemeProvider, currentTheme } from 'solid-theme-provider';

<ThemeProvider label="Toggle Theme">
<MyComponent theme={currentTheme()}>

Bugfix

03 Jun 00:20
0d0ead8
Compare
Choose a tag to compare

The library now sets the theme to match system preference (light or dark) properly at initialization.

Dropdown Directions

01 Jan 19:22
a8d2ffd
Compare
Choose a tag to compare

You can now specify the direction you want the dropdown to pop when more than 2 themes are configured. There are 4 possible settings that correspond to the ordinal directions, ["ne", "se", "sw", "nw"].

More info can be found in the docs.

Dropdown Styles

06 Dec 04:09
965636b
Compare
Choose a tag to compare

The default styles have been modified so that the theme options are legible when the dropdown is expanded over page body content.

Bug Fix

12 Nov 00:31
ebdce4d
Compare
Choose a tag to compare

Bug fix for issue #2

Theme toggle button was not transforming into a dropdown list when 3 themes were provided in the component's themes prop object.

Advanced Image Theming

28 Sep 00:59
ec031e9
Compare
Choose a tag to compare

The library now preserves image hues when inverting selected images to match the chosen theme.

Example of inverting a light image

More Info