Module: images

This is a registry of HTMLImageIcon objects.

Hypergrid comes with a few images (see below).

Application developer is free to register additional image objects here (see add).

Members

(static) calendar

(static) checkbox-off

Synonym of unchecked (unaffected if unchecked overridden).

(static) checkbox-on

Synonym of checked (unaffected if checked overridden).

(static) checked

(static) filter-off

(static) filter-on

(static) unchecked

(static) up-down

Methods

(static) add(name, img, themeableopt, setSvgPropsopt, stylesopt)

Parameters:
Name Type Attributes Default Description
name string
img HTMLImageElement
themeable boolean <optional>

If truthy, the image will be themed by images.setTheme, called by Hypergrid.applyTheme. If falsy, the image won't be themed until images[name].themeable is set to true. In any case the remaining parameters are processed.

setSvgProps function <optional>
svgThemer.setSvgProps

Optional custom theming code for this image and the rules implied by styles. If omitted, styles is promoted 2nd parameter position.

styles boolean | Array.<string> <optional>

Optional list style names with which to create CSS rules.

  • If falsy (or omitted), no rules are created.
  • Else if truthy but not an array, create a single rule: ``css.hypergrid-background-image-name { background-image: url(...) }where _name_ is the value of thename` parameter.
  • Else if an array, create a CSS rule for each style named therein.

For each rule thus created:

  • Inserted into style#injected-stylesheet-grid.
  • Selector is .hypergrid-style-name (where style is element value and name is image name). (If a rule with that selector already exists, it is replaced.)
  • Contains the named style with a value of url(...) where ... is the image data. Possible styles must be one of those listed in {*link https://github.com/joneit/svg-themer/blob/master/README.md#cssimagepropertynames svgThemer.cssImagePropertyNames} (which you can extend if needed).
  • Will be automatically themed when the grid is themed (which is the whole point).
See:

(static) checkbox(state) → {HTMLImageElement}

Convenience function.

Parameters:
Name Type Description
state boolean
Returns:

checked when state is truthy or unchecked otherwise.

Type
HTMLImageElement

(static) filter(state) → {HTMLImageElement}

Convenience function.

Parameters:
Name Type Description
state boolean
Returns:

filter-off when state is truthy or filter-on otherwise.

Type
HTMLImageElement

(static) setTheme(theme)

Parameters:
Name Type Description
theme object