npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ibm-wch-sdk-theme

v5.0.361

Published

Module that implements @ngrx bindings to the login and logout functionality as offered by the ibm-wch-sdk-ng modules.

Downloads

62

Readme

ibm-wch-sdk-theme

Module that implements utility functions to deal with theme like UI configuration in WCH for single page applications.

Details

Refer to the documentation.

Changes

CHANGELOG

Class documentation

Refer to the documentation.

Usage

Install the module via

npm install --save ibm-wch-sdk-theme

Theme Module

This module provides utility classes to compute UI customization based on content items.

Usecase

Allow a business user to customize the color scheme of a single page application by making modifications to a content item using the WCH admin UI. Without having to touch the source code of the deployed application.

Usage

  • The colors sub module exposes functions to compute color variations based on a (configured) base color. This can be used to automatically build a color palette.
  • The theme sub module computes CSS styles and CSS variables based on a RenderingContext.

Changelog

Current

Added

  • Initial version

ibm-wch-sdk-theme

Index

External modules


Colors

A theme color palette typically consists of a set of base colors (such as primary or secondary) and derivations of these colors. Business users only want to customize the base colors, the variations can be computed.

Functions

  • the colorVariations method computes color variations for a base color by computing a set of darker and lighter colors. The result is provided as a mapping from CSS variable to color value.

Naming Scheme

The CSS variables are named using the following pattern: --${basename}-${method}-${level} where:

  • basename: logical name of the color in the scheme
  • method: variation, e.g. darken or lighten
  • level: percent value of the application of the method. A value darken-5 e.g. means that the base color has been darkened by 5%.

Theme Utilities

The utilities compute a full set of styles based on a RenderingContext.

Usage

Exposed functions:

External module: "colors/colors"

Index

Interfaces

Type aliases

Variables

Functions

Object literals


Type aliases

ColorParser

Ƭ ColorParser: UnaryFunction<string, RGBA>

Defined in colors/colors.ts:20


Variables

<Const> colorToHSLA

● colorToHSLA: UnaryFunction<RGBA, HSLA> = rgbaToHsla

Defined in colors/colors.ts:136


<Const> colorToRGBA

● colorToRGBA: UnaryFunction<RGBA, RGBA> = identity

Defined in colors/colors.ts:135


Functions

<Const> colorParser

colorParser(aDoc: Document): function

Defined in colors/colors.ts:72

Constructs a function that parses a color value using the DOM APIs

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | aDoc | Document | the document |

Returns: function the parser function


<Const> colorValue

colorValue(aKey: string, aColor: RGBA): Styles

Defined in colors/colors.ts:60

Parameters:

| Param | Type | | ------ | ------ | | aKey | string | | aColor | RGBA |

Returns: Styles


<Const> colorVariations

colorVariations(aKey: string, aColor: RGBA): Styles

Defined in colors/colors.ts:129

Parameters:

| Param | Type | | ------ | ------ | | aKey | string | | aColor | RGBA |

Returns: Styles


<Const> decomposeColor

decomposeColor(aKey: string, aColor: RGBA): Styles

Defined in colors/colors.ts:111

Decompose the color string into color components

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | aKey | string | the name of the color | | aColor | RGBA | the actual color value |

Returns: Styles the styles


<Const> noParser

noParser(color: string): RGBA

Defined in colors/colors.ts:64

Parameters:

| Param | Type | | ------ | ------ | | color | string |

Returns: RGBA


rgbaToHsla

rgbaToHsla(rgb: RGBA): HSLA

Defined in colors/colors.ts:33

Converts an RGB color value to HSL. Conversion formula adapted from http://en.wikipedia.org/wiki/HSL_color_space. Assumes r, g, and b are contained in the set [0, 255] and returns h, s, and l in the set [0, 1].

Parameters:

| Param | Type | | ------ | ------ | | rgb | RGBA |

Returns: HSLA Array The HSL representation


rgbaToString

rgbaToString(rgb: RGBA): string

Defined in colors/colors.ts:55

Parameters:

| Param | Type | | ------ | ------ | | rgb | RGBA |

Returns: string


Object literals

<Const> BLACK

BLACK: object

Defined in colors/colors.ts:62

a

● a: number = 1

Defined in colors/colors.ts:62


b

● b: number = 0

Defined in colors/colors.ts:62


g

● g: number = 0

Defined in colors/colors.ts:62


r

● r: number = 0

Defined in colors/colors.ts:62



ibm-wch-sdk-theme > "colors/index"

External module: "colors/index"

Index


ibm-wch-sdk-theme > "index"

External module: "index"

Index


ibm-wch-sdk-theme > "styles"

External module: "styles"

Index

Interfaces


ibm-wch-sdk-theme > "theme/index"

External module: "theme/index"

Index


ibm-wch-sdk-theme > "theme/theme"

External module: "theme/theme"

Index

Variables

Functions


Variables

<Const> COLOR_SUFFIX

● COLOR_SUFFIX: "Color" = "Color"

Defined in theme/theme.ts:7


<Const> NULL_COLOR

● NULL_COLOR: RGBA = null

Defined in theme/theme.ts:11


Functions

<Const> _colorName

_colorName(name: string): string

Defined in theme/theme.ts:9

Parameters:

| Param | Type | | ------ | ------ | | name | string |

Returns: string


<Const> stylesFromRenderingContext

stylesFromRenderingContext(aRenderingContext: RenderingContext, aParser: ColorParser): Styles

Defined in theme/theme.ts:22

Derives styles based on a rendering context assuming that the contet represents a theme configuration. Color names are expected to be represented as elements of type 'text'. The element label has to end with the term 'Color', the prefix will be the name of the actual CSS color variable (e.g. 'primaryColor').

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | aRenderingContext | RenderingContext | the rendering context of the theme | | aParser | ColorParser |

Returns: Styles a styles object with the computed styles


ibm-wch-sdk-theme

Index

External modules


ibm-wch-sdk-theme > "colors/colors" > HSLA

Interface: HSLA

Hierarchy

HSLA

Index

Properties


Properties

a

● a: number

Defined in colors/colors.ts:10


h

● h: number

Defined in colors/colors.ts:7


l

● l: number

Defined in colors/colors.ts:9


s

● s: number

Defined in colors/colors.ts:8


ibm-wch-sdk-theme > "colors/colors" > RGBA

Interface: RGBA

Hierarchy

RGBA

Index

Properties


Properties

a

● a: number

Defined in colors/colors.ts:17


b

● b: number

Defined in colors/colors.ts:16


g

● g: number

Defined in colors/colors.ts:15


r

● r: number

Defined in colors/colors.ts:14


ibm-wch-sdk-theme > "styles" > Styles

Interface: Styles

Hierarchy

Styles

Indexable

[key: string]:  string | number

Index