@plentymarkets/shop-api / tagGetters
Variable: tagGetters ​
consttagGetters:object
Defined in: getters/tagGetters.ts:74
Type Declaration ​
getAgenciesTagCLass ​
getAgenciesTagCLass: (
tag) =>string
Returns a CSS class name derived from the tag ID (e.g. "tag-42").
Parameters ​
tag ​
The product tag object.
Returns ​
string
The CSS class name string.
getTagBackgroundColor ​
getTagBackgroundColor: (
tag) =>string
Returns the background color of a product tag.
Parameters ​
tag ​
The product tag object.
Returns ​
string
The hex color string (e.g. "#ff0000"), defaulting to "#ffffff" if not set.
getTagId ​
getTagId: (
tag) =>string
Returns the numeric ID of a product tag as a string.
Parameters ​
tag ​
The product tag object.
Returns ​
string
The tag ID string.
getTagName ​
getTagName: (
tag) =>string
Returns the display name of a product tag.
Parameters ​
tag ​
The product tag object.
Returns ​
string
The tag name string, or an empty string if not set.
getTags ​
getTags: (
product) =>ProductTag[]
Returns the list of tags associated with a product, filtered to exclude tags with empty names.
Parameters ​
product ​
The product object.
Returns ​
An array of ProductTag objects with non-empty names, or an empty array if none exist.
getTagTextColorIsDark ​
getTagTextColorIsDark: (
tag) =>boolean
Returns whether the tag's background color is considered dark, meaning light text should be used. Uses the luminance formula to determine perceived brightness from the background hex color.
Parameters ​
tag ​
The product tag object.
Returns ​
boolean
true if the background color is dark (luminance > 128), otherwise false.