<commit_before>// Perceived Brightness
//
// get "brightness" of a color on a scale of 0-255
// based on yiq color space
// -------------------------------------------------------------

@function getPerceivedBrightness( $color ) {
	$R: red($color);
	$G: green($color);
	$B: blue($color);

	@return ( ($R * 299) + ($G * 587) + ($B * 114) )/1000;
}



// isDark/isLight
//
// is this color what we would call "dark" or "light"?
// -------------------------------------------------------------
$brightness_threshold: 140;

@function isDark( $color ) {
	@if getPerceivedBrightness($color) < $brightness_threshold {
		@return false;
	} @else {
		@return true;
	}
}

@function isLight( $color ) {
	@if getPerceivedBrightness($color) < $brightness_threshold {
		@return false;
	} @else {
		@return true;
	}
}



// getContrastTextColor
//
// returns dark or light text color that has sufficient contrast
// with provided color
// -------------------------------------------------------------
$contrast_color_white: #fff;
$contrast_color_black: #222;

@function getContrastTextColor( $color ) {
	@if isDark($color) {
		@return $contrast_color_white;
	} @else {
		@return $contrast_color_black;
	}
}



// getContrastingOffset
//
// returns a contrasting shade or tint of a given color depending
// on if it's light or dark
// -------------------------------------------------------------

@function getContrastingOffset( $color ) {
	@if isDark($color) {
		@return lighten($color, 80%);
	} @else {
		@return darken($color, 80%);
	}
}<commit_msg>small tweaks on brightness functions<commit_after>// Perceived Brightness
//
// get "brightness" of a color on a scale of 0-255
// based on yiq color space
// -------------------------------------------------------------

@function getPerceivedBrightness( $color ) {
	$R: red($color);
	$G: green($color);
	$B: blue($color);

	@return ( ($R * 299) + ($G * 587) + ($B * 114) )/1000;
}



// isDark/isLight
//
// is this color what we would call "dark" or "light"?
// -------------------------------------------------------------
$brightness_threshold: 140;

@function isDark( $color, $threshold: $brightness_threshold ) {
	@if getPerceivedBrightness($color) < $threshold {
		@return false;
	} @else {
		@return true;
	}
}

@function isLight( $color, $threshold: $brightness_threshold ) {
	@if getPerceivedBrightness($color) < $threshold {
		@return false;
	} @else {
		@return true;
	}
}



// getContrastTextColor
//
// returns dark or light text color that has sufficient contrast
// with provided color
// -------------------------------------------------------------
$contrast_color_white: #fff;
$contrast_color_black: #222;

@function getContrastTextColor( $color ) {
	@if isDark($color) {
		@return $contrast_color_white;
	} @else {
		@return $contrast_color_black;
	}
}



// getContrastingOffset
//
// returns a contrasting shade or tint of a given color depending
// on if it's light or dark
// -------------------------------------------------------------
@function getContrastingOffset( $color, $offset: 80% ) {
	@if isDark($color) {
		@return lighten($color, $offset);
	} @else {
		@return darken($color, $offset);
	}
}
{'fraction_non_alphanumeric': 0.28237523689197724, 'fraction_numerical': 0.016424510423247, 'mean_word_length': 2.0161904761904763, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5199697', 'n_tokens_mistral': 1050, 'n_tokens_neox': 945, 'n_words': 266}