Spec-Zone.ru › Sass

SassColor

Sass's color type.

No matter what representation was originally used to create this color, all of its channels are accessible.

Hierarchy

  • Value
    • SassColor
  • Defined in js-api-doc/value/color.d.ts:110
Index

Constructors

constructor

Accessors

alpha asList blackness blue channels channelsOrNull green hasBrackets hue isLegacy isTruthy lightness realNull red saturation separator space whiteness

Methods

assertBoolean assertCalculation assertColor assertFunction assertMap assertMixin assertNumber assertString change channel equals get hashCode interpolate isChannelMissing isChannelPowerless isInGamut sassIndexToListIndex toGamut toSpace tryMap

Constructors

constructor

  • new SassColor(options: {
    alpha?: null | number;
    blue: null | number;
    green: null | number;
    red: null | number;
    space?: "rgb";
    }): SassColor
  • Creates an RGB color.

    If space is missing, only undefined should be used to indicate that alpha isn't passed. If null is used instead, it will be treated as a missing component. See breaking changes for details.

    If space is defined and null is passed for any component, it will be treated as a missing component.

    Throws

    Error if alpha is set and isn't null or a number between 0 and 1.

    Parameters

    • options: {
      alpha?: null | number;
      blue: null | number;
      green: null | number;
      red: null | number;
      space?: "rgb";
      }
      • Optional alpha?: null | number
      • blue: null | number
      • green: null | number
      • red: null | number
      • Optional space?: "rgb"

    Returns SassColor

    Overrides Value.constructor

    • Defined in js-api-doc/value/color.d.ts:128

constructor

  • new SassColor(options: {
    alpha?: null | number;
    hue: null | number;
    lightness: null | number;
    saturation: null | number;
    space?: "hsl";
    }): SassColor
  • Creates an HSL color.

    If space is missing, only undefined should be used to indicate that alpha isn't passed. If null is used instead, it will be treated as a missing component. See breaking changes for details.

    If space is defined and null is passed for any component, it will be treated as a missing component.

    Throws

    Error if alpha is set and isn't null or a number between 0 and 1.

    Parameters

    • options: {
      alpha?: null | number;
      hue: null | number;
      lightness: null | number;
      saturation: null | number;
      space?: "hsl";
      }
      • Optional alpha?: null | number
      • hue: null | number
      • lightness: null | number
      • saturation: null | number
      • Optional space?: "hsl"

    Returns SassColor

    Overrides Value.constructor

    • Defined in js-api-doc/value/color.d.ts:153

constructor

  • new SassColor(options: {
    alpha?: null | number;
    blackness: null | number;
    hue: null | number;
    space?: "hwb";
    whiteness: null | number;
    }): SassColor
  • Creates an HWB color.

    If space is missing, only undefined should be used to indicate that alpha isn't passed. If null is used instead, it will be treated as a missing component. See breaking changes for details.

    If space is defined and null is passed for any component, it will be treated as a missing component.

    Throws

    Error if alpha is set and isn't null or a number between 0 and 1.

    Parameters

    • options: {
      alpha?: null | number;
      blackness: null | number;
      hue: null | number;
      space?: "hwb";
      whiteness: null | number;
      }
      • Optional alpha?: null | number
      • blackness: null | number
      • hue: null | number
      • Optional space?: "hwb"
      • whiteness: null | number

    Returns SassColor

    Overrides Value.constructor

    • Defined in js-api-doc/value/color.d.ts:178

constructor

  • new SassColor(options: {
    a: null | number;
    alpha?: null | number;
    b: null | number;
    lightness: null | number;
    space: ColorSpaceLab;
    }): SassColor
  • Creates a Lab or Oklab color.

    If null is passed for any component, it will be treated as a missing component.

    Throws

    Error if alpha is set and isn't null or a number between 0 and 1.

    Parameters

    • options: {
      a: null | number;
      alpha?: null | number;
      b: null | number;
      lightness: null | number;
      space: ColorSpaceLab;
      }
      • a: null | number
      • Optional alpha?: null | number
      • b: null | number
      • lightness: null | number
      • space: ColorSpaceLab

    Returns SassColor

    Overrides Value.constructor

    • Defined in js-api-doc/value/color.d.ts:199

constructor

  • new SassColor(options: {
    alpha?: null | number;
    chroma: null | number;
    hue: null | number;
    lightness: null | number;
    space: ColorSpaceLch;
    }): SassColor
  • Creates an LCH or Oklch color.

    If null is passed for any component, it will be treated as a missing component.

    Throws

    Error if alpha is set and isn't null or a number between 0 and 1.

    Parameters

    • options: {
      alpha?: null | number;
      chroma: null | number;
      hue: null | number;
      lightness: null | number;
      space: ColorSpaceLch;
      }
      • Optional alpha?: null | number
      • chroma: null | number
      • hue: null | number
      • lightness: null | number
      • space: ColorSpaceLch

    Returns SassColor

    Overrides Value.constructor

    • Defined in js-api-doc/value/color.d.ts:220

constructor

  • new SassColor(options: {
    alpha?: null | number;
    blue: null | number;
    green: null | number;
    red: null | number;
    space: "display-p3" | "srgb" | "rec2020" | "a98-rgb" | "display-p3-linear" | "prophoto-rgb" | "srgb-linear";
    }): SassColor
  • Creates a color in a predefined RGB color space.

    If null is passed for any component, it will be treated as a missing component.

    Throws

    Error if alpha is set and isn't null or a number between 0 and 1.

    Parameters

    • options: {
      alpha?: null | number;
      blue: null | number;
      green: null | number;
      red: null | number;
      space: "display-p3" | "srgb" | "rec2020" | "a98-rgb" | "display-p3-linear" | "prophoto-rgb" | "srgb-linear";
      }
      • Optional alpha?: null | number
      • blue: null | number
      • green: null | number
      • red: null | number
      • space: "display-p3" | "srgb" | "rec2020" | "a98-rgb" | "display-p3-linear" | "prophoto-rgb" | "srgb-linear"

    Returns SassColor

    Overrides Value.constructor

    • Defined in js-api-doc/value/color.d.ts:240

constructor

  • new SassColor(options: {
    alpha?: null | number;
    space: ColorSpaceXyz;
    x: null | number;
    y: null | number;
    z: null | number;
    }): SassColor
  • Creates a color in a predefined XYZ color space.

    If null is passed for any component, it will be treated as a missing component.

    Throws

    Error if alpha is set and isn't null or a number between 0 and 1.

    Parameters

    • options: {
      alpha?: null | number;
      space: ColorSpaceXyz;
      x: null | number;
      y: null | number;
      z: null | number;
      }
      • Optional alpha?: null | number
      • space: ColorSpaceXyz
      • x: null | number
      • y: null | number
      • z: null | number

    Returns SassColor

    Overrides Value.constructor

    • Defined in js-api-doc/value/color.d.ts:260

Accessors

alpha

  • get alpha(): number
  • This color's alpha channel, between 0 and 1.

    Returns number

    • Defined in js-api-doc/value/color.d.ts:344

asList

  • get asList(): List<Value>
  • This value as a list.

    All SassScript values can be used as lists. Maps count as lists of pairs, and all other values count as single-value lists.

    Returns List<Value>

    An immutable List from the immutable package.

    Inherited from Value.asList

    • Defined in js-api-doc/value/index.d.ts:77

blackness

  • get blackness(): number
  • This color's blackness in the HWB color space.

    Deprecated

    Use channel instead.

    Returns number

    • Defined in js-api-doc/value/color.d.ts:566

blue

  • get blue(): number
  • This color's blue channel in the RGB color space.

    Deprecated

    Use channel instead.

    Returns number

    • Defined in js-api-doc/value/color.d.ts:531

channels

  • get channels(): List<number>
  • A list of this color's channel values (excluding alpha), with missing channels converted to 0.

    Returns List<number>

    • Defined in js-api-doc/value/color.d.ts:314

channelsOrNull

  • get channelsOrNull(): List<null | number>
  • A list of this color's channel values (excluding alpha), with missing channels converted to null.

    Returns List<null | number>

    • Defined in js-api-doc/value/color.d.ts:306

green

  • get green(): number
  • This color's green channel in the RGB color space.

    Deprecated

    Use channel instead.

    Returns number

    • Defined in js-api-doc/value/color.d.ts:524

hasBrackets

  • get hasBrackets(): boolean
  • Whether this value as a list has brackets.

    All SassScript values can be used as lists. Maps count as lists of pairs, and all other values count as single-value lists.

    Returns boolean

    Inherited from Value.hasBrackets

    • Defined in js-api-doc/value/index.d.ts:85

hue

  • get hue(): number
  • This color's hue in the HSL color space.

    Deprecated

    Use channel instead.

    Returns number

    • Defined in js-api-doc/value/color.d.ts:538

isLegacy

  • get isLegacy(): boolean
  • A boolean indicating whether this color is in a legacy color space (rgb, hsl, or hwb).

    Returns boolean

    • Defined in js-api-doc/value/color.d.ts:281

isTruthy

  • get isTruthy(): boolean
  • Whether the value counts as true in an @if statement and other contexts.

    Returns boolean

    Inherited from Value.isTruthy

    • Defined in js-api-doc/value/index.d.ts:91

lightness

  • get lightness(): number
  • This color's lightness in the HSL color space.

    Deprecated

    Use channel instead.

    Returns number

    • Defined in js-api-doc/value/color.d.ts:552

realNull

  • get realNull(): null | Value
  • Returns JavaScript's null value if this is sassNull, and returns this otherwise.

    Returns null | Value

    Inherited from Value.realNull

    • Defined in js-api-doc/value/index.d.ts:97

red

  • get red(): number
  • This color's red channel in the RGB color space.

    Deprecated

    Use channel instead.

    Returns number

    • Defined in js-api-doc/value/color.d.ts:517

saturation

  • get saturation(): number
  • This color's saturation in the HSL color space.

    Deprecated

    Use channel instead.

    Returns number

    • Defined in js-api-doc/value/color.d.ts:545

separator

  • get separator(): ListSeparator
  • The separator for this value as a list.

    All SassScript values can be used as lists. Maps count as lists of pairs, and all other values count as single-value lists.

    Returns ListSeparator

    Inherited from Value.separator

    • Defined in js-api-doc/value/index.d.ts:105

space

  • get space(): KnownColorSpace
  • The name of this color's space.

    Returns KnownColorSpace

    • Defined in js-api-doc/value/color.d.ts:269

whiteness

  • get whiteness(): number
  • This color's whiteness in the HWB color space.

    Deprecated

    Use channel instead.

    Returns number

    • Defined in js-api-doc/value/color.d.ts:559

Methods

assertBoolean

  • assertBoolean(name?: string): SassBoolean
  • Throws if this isn't a SassBoolean.

    Functions should generally use isTruthy rather than requiring a literal boolean.

    Parameters

    • Optional name: string

      The name of the function argument this came from (without the $) if it came from an argument. Used for error reporting.

    Returns SassBoolean

    Inherited from Value.assertBoolean

    • Defined in js-api-doc/value/index.d.ts:147

assertCalculation

  • assertCalculation(name?: string): SassCalculation
  • Throws if this isn't a SassCalculation.

    Parameters

    • Optional name: string

      The name of the function argument this came from (without the $) if it came from an argument. Used for error reporting.

    Returns SassCalculation

    Inherited from Value.assertCalculation

    • Defined in js-api-doc/value/index.d.ts:155

assertColor

  • assertColor(name?: string): SassColor
  • Throws if this isn't a SassColor.

    Parameters

    • Optional name: string

      The name of the function argument this came from (without the $) if it came from an argument. Used for error reporting.

    Returns SassColor

    Inherited from Value.assertColor

    • Defined in js-api-doc/value/index.d.ts:163

assertFunction

  • assertFunction(name?: string): SassFunction
  • Throws if this isn't a SassFunction.

    Parameters

    • Optional name: string

      The name of the function argument this came from (without the $) if it came from an argument. Used for error reporting.

    Returns SassFunction

    Inherited from Value.assertFunction

    • Defined in js-api-doc/value/index.d.ts:171

assertMap

  • assertMap(name?: string): SassMap
  • Throws if this isn't a SassMap.

    Parameters

    • Optional name: string

      The name of the function argument this came from (without the $) if it came from an argument. Used for error reporting.

    Returns SassMap

    Inherited from Value.assertMap

    • Defined in js-api-doc/value/index.d.ts:179

assertMixin

  • assertMixin(name?: string): SassMixin
  • Throws if this isn't a SassMixin.

    Parameters

    • Optional name: string

      The name of the function argument this came from (without the $) if it came from an argument. Used for error reporting.

    Returns SassMixin

    Inherited from Value.assertMixin

    • Defined in js-api-doc/value/index.d.ts:187

assertNumber

  • assertNumber(name?: string): SassNumber
  • Throws if this isn't a SassNumber.

    Parameters

    • Optional name: string

      The name of the function argument this came from (without the $) if it came from an argument. Used for error reporting.

    Returns SassNumber

    Inherited from Value.assertNumber

    • Defined in js-api-doc/value/index.d.ts:195

assertString

  • assertString(name?: string): SassString
  • Throws if this isn't a SassString.

    Parameters

    • Optional name: string

      The name of the function argument this came from (without the $) if it came from an argument. Used for error reporting.

    Returns SassString

    Inherited from Value.assertString

    • Defined in js-api-doc/value/index.d.ts:203

change

  • change(options: {
    alpha: undefined | null | number;
    hue: undefined | null | number;
    lightness: undefined | null | number;
    saturation: undefined | null | number;
    } & {
    space?: "hsl";
    }): SassColor
  • Returns a new color that's the result of changing one or more of this color's HSL channels.

    Throws

    Error if space is missing and this color is not in a legacy color space (rgb, hsl, or hwb).

    Throws

    Error if alpha is set and isn't null or a number between 0 and 1.

    Parameters

    • options: {
      alpha: undefined | null | number;
      hue: undefined | null | number;
      lightness: undefined | null | number;
      saturation: undefined | null | number;
      } & {
      space?: "hsl";
      }

    Returns SassColor

    • Defined in js-api-doc/value/color.d.ts:419

change

  • change(options: {
    alpha: undefined | null | number;
    blackness: undefined | null | number;
    hue: undefined | null | number;
    whiteness: undefined | null | number;
    } & {
    space?: "hwb";
    }): SassColor
  • Returns a new color that's the result of changing one or more of this color's HWB channels.

    Throws

    Error if space is missing and this color is not in a legacy color space (rgb, hsl, or hwb).

    Throws

    Error if alpha is set and isn't null or a number between 0 and 1.

    Parameters

    • options: {
      alpha: undefined | null | number;
      blackness: undefined | null | number;
      hue: undefined | null | number;
      whiteness: undefined | null | number;
      } & {
      space?: "hwb";
      }

    Returns SassColor

    • Defined in js-api-doc/value/color.d.ts:436

change

  • change(options: {
    a: undefined | null | number;
    alpha: undefined | null | number;
    b: undefined | null | number;
    lightness: undefined | null | number;
    } & {
    space?: ColorSpaceLab;
    }): SassColor
  • Returns a new color that's the result of changing one or more of this color's Lab channels.

    Throws

    Error if space is missing and this color is not in the Lab or Oklab color spaces.

    Throws

    Error if alpha is set and isn't null or a number between 0 and 1.

    Parameters

    • options: {
      a: undefined | null | number;
      alpha: undefined | null | number;
      b: undefined | null | number;
      lightness: undefined | null | number;
      } & {
      space?: ColorSpaceLab;
      }

    Returns SassColor

    • Defined in js-api-doc/value/color.d.ts:453

change

  • change(options: {
    alpha: undefined | null | number;
    chroma: undefined | null | number;
    hue: undefined | null | number;
    lightness: undefined | null | number;
    } & {
    space?: ColorSpaceLch;
    }): SassColor
  • Returns a new color that's the result of changing one or more of this color's LCH channels.

    Throws

    Error if space is missing and this color is not in the LCH or Oklch color spaces.

    Throws

    Error if alpha is set and isn't null or a number between 0 and 1.

    Parameters

    • options: {
      alpha: undefined | null | number;
      chroma: undefined | null | number;
      hue: undefined | null | number;
      lightness: undefined | null | number;
      } & {
      space?: ColorSpaceLch;
      }

    Returns SassColor

    • Defined in js-api-doc/value/color.d.ts:470

change

  • change(options: {
    alpha: undefined | null | number;
    blue: undefined | null | number;
    green: undefined | null | number;
    red: undefined | null | number;
    } & {
    space?: ColorSpaceRgb;
    }): SassColor
  • Returns a new color that's the result of changing one or more of this color's RGB channels.

    Throws

    Error if space is missing and this color is not in a legacy color space (rgb, hsl, or hwb).

    Throws

    Error if alpha is set and isn't null or a number between 0 and 1.

    Parameters

    • options: {
      alpha: undefined | null | number;
      blue: undefined | null | number;
      green: undefined | null | number;
      red: undefined | null | number;
      } & {
      space?: ColorSpaceRgb;
      }

    Returns SassColor

    • Defined in js-api-doc/value/color.d.ts:487

change

  • change(options: {
    alpha: undefined | null | number;
    x: undefined | null | number;
    y: undefined | null | number;
    z: undefined | null | number;
    } & {
    space?: ColorSpaceXyz;
    }): SassColor
  • Returns a new color that's the result of changing one or more of this color's XYZ channels.

    Throws

    Error if space is missing and this color is not in an XYZ color space.

    Throws

    Error if alpha is set and isn't null or a number between 0 and 1.

    Parameters

    • options: {
      alpha: undefined | null | number;
      x: undefined | null | number;
      y: undefined | null | number;
      z: undefined | null | number;
      } & {
      space?: ColorSpaceXyz;
      }

    Returns SassColor

    • Defined in js-api-doc/value/color.d.ts:504

channel

  • channel(channel: ChannelName): number
  • Returns the value of a single specified channel of this color, with missing channels converted to 0.

    Throws

    Error if channel is not alpha or a channel in this color's space.

    Parameters

    • channel: ChannelName

    Returns number

    • Defined in js-api-doc/value/color.d.ts:325

channel

  • channel(channel: ChannelNameHsl, options: {
    space: "hsl";
    }): number
  • Returns the value of a single specified channel of this color after converting this color to the specified space, with missing channels converted to 0.

    Throws

    Error if channel is not alpha or a channel in space.

    Parameters

    • channel: ChannelNameHsl
    • options: {
      space: "hsl";
      }
      • space: "hsl"

    Returns number

    • Defined in js-api-doc/value/color.d.ts:336

channel

  • channel(channel: ChannelNameHwb, options: {
    space: "hwb";
    }): number
  • Parameters

    • channel: ChannelNameHwb
    • options: {
      space: "hwb";
      }
      • space: "hwb"

    Returns number

    • Defined in js-api-doc/value/color.d.ts:337

channel

  • channel(channel: ChannelNameLab, options: {
    space: ColorSpaceLab;
    }): number
  • Parameters

    • channel: ChannelNameLab
    • options: {
      space: ColorSpaceLab;
      }
      • space: ColorSpaceLab

    Returns number

    • Defined in js-api-doc/value/color.d.ts:338

channel

  • channel(channel: ChannelNameLch, options: {
    space: ColorSpaceLch;
    }): number
  • Parameters

    • channel: ChannelNameLch
    • options: {
      space: ColorSpaceLch;
      }
      • space: ColorSpaceLch

    Returns number

    • Defined in js-api-doc/value/color.d.ts:339

channel

  • channel(channel: ChannelNameRgb, options: {
    space: ColorSpaceRgb;
    }): number
  • Parameters

    • channel: ChannelNameRgb
    • options: {
      space: ColorSpaceRgb;
      }
      • space: ColorSpaceRgb

    Returns number

    • Defined in js-api-doc/value/color.d.ts:340

channel

  • channel(channel: ChannelNameXyz, options: {
    space: ColorSpaceXyz;
    }): number
  • Parameters

    • channel: ChannelNameXyz
    • options: {
      space: ColorSpaceXyz;
      }
      • space: ColorSpaceXyz

    Returns number

    • Defined in js-api-doc/value/color.d.ts:341

equals

  • equals(other: Value): boolean
  • Returns whether this represents the same value as other.

    Parameters

    • other: Value

    Returns boolean

    Inherited from Value.equals

    • Defined in js-api-doc/value/index.d.ts:212

get

  • get(index: number): undefined | Value
  • Returns the value at index index in this value as a list, or undefined if index isn't valid for this list.

    All SassScript values can be used as lists. Maps count as lists of pairs, and all other values count as single-value lists.

    This is a shorthand for this.asList.get(index), although it may be more efficient in some cases.

    This method uses the same indexing conventions as the immutable package: unlike Sass the index of the first element is 0, but like Sass negative numbers index from the end of the list.

    Parameters

    • index: number

    Returns undefined | Value

    Inherited from Value.get

    • Defined in js-api-doc/value/index.d.ts:136

hashCode

  • hashCode(): number
  • Returns a hash code that can be used to store this in a hash map.

    Returns number

    Inherited from Value.hashCode

    • Defined in js-api-doc/value/index.d.ts:215

interpolate

  • interpolate(color2: SassColor, options?: {
    method?: HueInterpolationMethod;
    weight?: number;
    }): SassColor
  • Returns a color partway between this color and color2 according to method, as defined by the CSS Color 4 color interpolation procedure.

    If method is missing and this color is in a rectangular color space (Lab, Oklab, RGB, and XYZ spaces), method defaults to the color space of this color. Otherwise, method defaults to a space separated list containing the color space of this color and the string "shorter".

    The weight is a number between 0 and 1 that indicates how much of this color should be in the resulting color. If omitted, it defaults to 0.5.

    Parameters

    • color2: SassColor
    • Optional options: {
      method?: HueInterpolationMethod;
      weight?: number;
      }
      • Optional method?: HueInterpolationMethod
      • Optional weight?: number

    Returns SassColor

    • Defined in js-api-doc/value/color.d.ts:402

isChannelMissing

  • isChannelMissing(channel: ChannelName): boolean
  • Returns a boolean indicating whether a given channel value is a missing channel.

    Parameters

    • channel: ChannelName

    Returns boolean

    • Defined in js-api-doc/value/color.d.ts:352

isChannelPowerless

  • isChannelPowerless(channel: ChannelName): boolean
  • Returns a boolean indicating whether a given channel is powerless in this color. This is a special state that's defined for individual color spaces, which indicates that a channel's value won't affect how a color is displayed.

    Parameters

    • channel: ChannelName

    Returns boolean

    • Defined in js-api-doc/value/color.d.ts:362

isChannelPowerless

  • isChannelPowerless(channel: ChannelNameHsl, options?: {
    space: "hsl";
    }): boolean
  • Parameters

    • channel: ChannelNameHsl
    • Optional options: {
      space: "hsl";
      }
      • space: "hsl"

    Returns boolean

    • Defined in js-api-doc/value/color.d.ts:363

isChannelPowerless

  • isChannelPowerless(channel: ChannelNameHwb, options?: {
    space: "hwb";
    }): boolean
  • Parameters

    • channel: ChannelNameHwb
    • Optional options: {
      space: "hwb";
      }
      • space: "hwb"

    Returns boolean

    • Defined in js-api-doc/value/color.d.ts:367

isChannelPowerless

  • isChannelPowerless(channel: ChannelNameLab, options?: {
    space: ColorSpaceLab;
    }): boolean
  • Parameters

    • channel: ChannelNameLab
    • Optional options: {
      space: ColorSpaceLab;
      }
      • space: ColorSpaceLab

    Returns boolean

    • Defined in js-api-doc/value/color.d.ts:371

isChannelPowerless

  • isChannelPowerless(channel: ChannelNameLch, options?: {
    space: ColorSpaceLch;
    }): boolean
  • Parameters

    • channel: ChannelNameLch
    • Optional options: {
      space: ColorSpaceLch;
      }
      • space: ColorSpaceLch

    Returns boolean

    • Defined in js-api-doc/value/color.d.ts:375

isChannelPowerless

  • isChannelPowerless(channel: ChannelNameRgb, options?: {
    space: ColorSpaceRgb;
    }): boolean
  • Parameters

    • channel: ChannelNameRgb
    • Optional options: {
      space: ColorSpaceRgb;
      }
      • space: ColorSpaceRgb

    Returns boolean

    • Defined in js-api-doc/value/color.d.ts:379

isChannelPowerless

  • isChannelPowerless(channel: ChannelNameXyz, options?: {
    space: ColorSpaceXyz;
    }): boolean
  • Parameters

    • channel: ChannelNameXyz
    • Optional options: {
      space: ColorSpaceXyz;
      }
      • space: ColorSpaceXyz

    Returns boolean

    • Defined in js-api-doc/value/color.d.ts:383

isInGamut

  • isInGamut(space?: KnownColorSpace): boolean
  • Returns a boolean indicating whether this color is in-gamut (as opposed to having one or more of its channels out of bounds) for the specified space, or its current color space if space is not specified.

    Parameters

    • Optional space: KnownColorSpace

    Returns boolean

    • Defined in js-api-doc/value/color.d.ts:288

sassIndexToListIndex

  • sassIndexToListIndex(sassIndex: Value, name?: string): number
  • Converts sassIndex into a JavaScript-style index into the list returned by asList.

    Sass indexes are one-based, while JavaScript indexes are zero-based. Sass indexes may also be negative in order to index from the end of the list.

    Throws

    Error If sassIndex isn't a number, if that number isn't an integer, or if that integer isn't a valid index for asList.

    Parameters

    • sassIndex: Value

      The Sass-style index into this as a list.

    • Optional name: string

      The name of the function argument sassIndex came from (without the $) if it came from an argument. Used for error reporting.

    Returns number

    Inherited from Value.sassIndexToListIndex

    • Defined in js-api-doc/value/index.d.ts:120

toGamut

  • toGamut(options: {
    method: GamutMapMethod;
    space?: KnownColorSpace;
    }): SassColor
  • Returns a copy of this color, modified so it is in-gamut for the specified space—or the current color space if space is not specified—using method to map out-of-gamut colors into the desired gamut.

    Parameters

    • options: {
      method: GamutMapMethod;
      space?: KnownColorSpace;
      }
      • method: GamutMapMethod
      • Optional space?: KnownColorSpace

    Returns SassColor

    • Defined in js-api-doc/value/color.d.ts:295

toSpace

  • toSpace(space: KnownColorSpace): SassColor
  • Returns a new color that's the result of converting this color to the specified space.

    Parameters

    • space: KnownColorSpace

    Returns SassColor

    • Defined in js-api-doc/value/color.d.ts:275

tryMap

  • tryMap(): null | SassMap
  • Returns this as a map if it counts as one (empty lists count as empty maps) or null if it doesn't.

    Returns null | SassMap

    Inherited from Value.tryMap

    • Defined in js-api-doc/value/index.d.ts:209
sass
  • Compile
    • AsyncCompiler
    • Compiler
    • CompileResult
    • compile
    • compileAsync
    • compileString
    • compileStringAsync
    • initAsyncCompiler
    • initCompiler
  • Options
    • Options
    • StringOptions
    • OutputStyle
    • StringOptionsWithImporter
    • StringOptionsWithoutImporter
    • Syntax
  • Logger
    • Logger
      • silent
    • Logger
    • SourceLocation
    • SourceSpan
    • LoggerWarnOptions
  • Importer
    • NodePackageImporter
    • FileImporter
    • Importer
    • ImporterResult
  • Custom Function
    • CalculationInterpolation
    • CalculationOperation
    • SassArgumentList
    • SassBoolean
    • SassCalculation
    • SassColor
    • SassFunction
    • SassList
    • SassMap
    • SassMixin
    • SassNumber
    • SassString
    • Value
    • CalculationOperator
    • CalculationValue
    • CustomFunction
    • ListSeparator
    • sassFalse
    • sassNull
    • sassTrue
  • Other
    • Exception
    • CanonicalizeContext
    • Deprecations
    • LegacyFileOptions
    • ChannelName
    • ChannelNameHsl
    • ChannelNameHwb
    • ChannelNameLab
    • ChannelNameLch
    • ChannelNameRgb
    • ChannelNameXyz
    • ColorSpaceHsl
    • ColorSpaceHwb
    • ColorSpaceLab
    • ColorSpaceLch
    • ColorSpaceRgb
    • ColorSpaceXyz
    • GamutMapMethod
    • HueInterpolationMethod
    • KnownColorSpace
    • PolarColorSpace
    • PromiseOr
    • RectangularColorSpace
    • info
  • Legacy
    • types
      • Boolean
      • Color
      • Error
      • List
      • Map
      • Null
      • Number
      • String
    • LegacyException
    • LegacyImporterThis
    • LegacyPluginThis
    • LegacyResult
    • LegacySharedOptions
    • LegacyStringOptions
    • LegacyAsyncFunction
    • LegacyAsyncFunctionDone
    • LegacyAsyncImporter
    • LegacyFunction
    • LegacyImporter
    • LegacyImporterResult
    • LegacyOptions
    • LegacySyncFunction
    • LegacySyncImporter
    • LegacyValue
    • FALSE
    • NULL
    • TRUE
    • render
    • renderSync
  • Messages
    • Version
    • Deprecation
    • DeprecationOrId
    • DeprecationStatus
    • deprecations

© 2006–2025 the Sass team, and numerous contributors
Licensed under the MIT License.
https://sass-lang.com/documentation/js-api/classes/SassColor

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API