UNPKG

zeplin-extension-style-kit

Version:

Models and utilities to generate CSS-like style code in Zeplin extensions.

27 lines (21 loc) 847 B
import { ColorNameResolver, ColorParams, LengthParams, StyleDeclaration } from "../common.js"; import { STYLE_PROPS } from "../constants.js"; import { Color, Length } from "../values/index.js"; export class TextStroke implements StyleDeclaration { length: Length; color: Color; constructor(length: Length, color: Color) { this.length = length; this.color = color; } get name(): string { return STYLE_PROPS.TEXT_STROKE; } equals(other: TextStroke): boolean { return this.length.equals(other.length) && this.color.equals(other.color); } getValue(params: LengthParams & ColorParams, colorNameResolver: ColorNameResolver): string { const { color, length } = this; return `${length.toStyleValue(params)} ${color.toStyleValue(params, colorNameResolver)}`; } }