// 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/src/parameter-type'


///
/// @throw `#{$color}` is not a color.
///
@function is-dark($color)

	@if meta.type-of($color) != 'color'
		@error parameter-type.parameter-type('is-dark', 'color', $color, 'color')

	@return math.div(color.channel($color, 'red', $space: rgb) * 299 + color.channel($color, 'green', $space: rgb) * 587 + color.channel($color, 'blue', $space: rgb) * 114, 1000) < 128
