parameter-type ()
Returns an error message stating a parameter received the wrong type.
Parameters
$context
- The name of the function or mixin issuing the error.
- Type
String
$name
- The name of the parameter which has received the wrong type.
- Type
String
$value
- The value which was received.
- Type
*
$types
- The types which are expected.
- Type
ArgList<*>
Return Value
String
- A string describing what types are acceptable for a parameter and the value that is invalid.
Example
@sass-fairy/color/src/_is-dark.sass
// Copyright (c) roydukkey. All rights reserved.
// Licensed under the MIT. See LICENSE file in the project root for full license information.
@use 'sass:color'
@use 'sass:math'
@use 'sass:meta'
@use '@sass-fairy/exception'
@function is-dark($color)
@if meta.type-of($color) != 'color'
@error exception.parameter-type('is-dark', 'color', $color, 'color')
@return math.div(color.red($color) * 299 + color.green($color) * 587 + color.blue($color) * 114, 1000) < 128