<commit_before>import { hexToRgb, rgbToHex, rgbToHsl, hslToRgb } from "./conversion";
import { darken, lighten, setLightness } from "./lightness";
import { fadeIn, fadeOut, setAlpha } from "./alpha";
import contrast from "./contrast";
import saturate from "./saturate";
import desaturate from "./desaturate";

const makeColor = (properties) => {
  const { rHex, gHex, bHex, r, g, b, h, s, l, a = 1 } = properties;
  const color = {
    ...properties,

    hex() {
      return `#${rHex}${gHex}${bHex}`;
    },
    rgb() {
      return (a < 1)
        ? `rgba(${r},${g},${b},${a})`
        : `rgb(${r},${g},${b})`
      ;
    },
    hsl() {
      return (a < 1)
        ? `hsla(${h},${s}%,${l}%,${a})`
        : `hsl(${h},${s}%,${l}%)`
      ;
    },
    luma: (299 * r + 587 * g + 114 * b) / 1000,
  }

  return {
    ...color,
    setLightness(percentage) {
      return setLightness(color, percentage);
    },<commit_msg>Add shorthand methods for light and dark via luma values<commit_after>import { hexToRgb, rgbToHex, rgbToHsl, hslToRgb } from "./conversion";
import { darken, lighten, setLightness } from "./lightness";
import { fadeIn, fadeOut, setAlpha } from "./alpha";
import contrast from "./contrast";
import saturate from "./saturate";
import desaturate from "./desaturate";

const makeColor = (properties) => {
  const { rHex, gHex, bHex, r, g, b, h, s, l, a = 1 } = properties;
  const color = {
    ...properties,

    hex() {
      return `#${rHex}${gHex}${bHex}`;
    },
    rgb() {
      return (a < 1)
        ? `rgba(${r},${g},${b},${a})`
        : `rgb(${r},${g},${b})`
      ;
    },
    hsl() {
      return (a < 1)
        ? `hsla(${h},${s}%,${l}%,${a})`
        : `hsl(${h},${s}%,${l}%)`
      ;
    },
    luma: (299 * r + 587 * g + 114 * b) / 1000,
  }

  return {
    ...color,
    isDark() {
      return color.luma < 128;
    },
    isLight() {
      return color.luma >= 128;
    },
    setLightness(percentage) {
      return setLightness(color, percentage);
    },
{'fraction_non_alphanumeric': 0.21782674011016526, 'fraction_numerical': 0.01902854281422133, 'mean_word_length': 2.493006993006993, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 6, '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': '6759170', 'n_tokens_mistral': 803, 'n_tokens_neox': 751, 'n_words': 175}