{"version":3,"file":"color-utils.mjs","names":[],"sources":["../../../../src/_generated/style-rules/color-utils.ts"],"sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/*!\n *\n *  Copyright (c) \"Neo4j\"\n *  Neo4j Sweden AB [http://neo4j.com]\n *\n *  This file is part of Neo4j.\n *\n *  Neo4j is free software: you can redistribute it and/or modify\n *  it under the terms of the GNU General Public License as published by\n *  the Free Software Foundation, either version 3 of the License, or\n *  (at your option) any later version.\n *\n *  This program is distributed in the hope that it will be useful,\n *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport type { RgbColor } from '@uiw/react-color';\n\n/**\n * Computes a linear interpolation weight in [0, 1] for `value` between\n * `startValue` and `endValue`. Values outside the range produce weights\n * outside [0, 1] — callers are responsible for clamping if needed.\n */\nexport function getWeight(\n  startValue: number,\n  endValue: number,\n  value: number,\n): number {\n  return (value - startValue) / (endValue - startValue);\n}\n\n/**\n * Linearly interpolates between two RGB colors by `weight` (0 = start, 1 = end).\n * Each channel is rounded to the nearest integer.\n */\nexport function lerpColor(\n  startColor: RgbColor,\n  endColor: RgbColor,\n  weight: number,\n): RgbColor {\n  return {\n    // oxlint-disable-next-line id-length\n    b: Math.round(startColor.b * (1 - weight) + endColor.b * weight),\n    // oxlint-disable-next-line id-length\n    g: Math.round(startColor.g * (1 - weight) + endColor.g * weight),\n    // oxlint-disable-next-line id-length\n    r: Math.round(startColor.r * (1 - weight) + endColor.r * weight),\n  };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,SAAgB,UACd,YACA,UACA,OACQ;CACR,QAAQ,QAAQ,eAAe,WAAW;AAC5C;;;;;AAMA,SAAgB,UACd,YACA,UACA,QACU;CACV,OAAO;EAEL,GAAG,KAAK,MAAM,WAAW,KAAK,IAAI,UAAU,SAAS,IAAI,MAAM;EAE/D,GAAG,KAAK,MAAM,WAAW,KAAK,IAAI,UAAU,SAAS,IAAI,MAAM;EAE/D,GAAG,KAAK,MAAM,WAAW,KAAK,IAAI,UAAU,SAAS,IAAI,MAAM;CACjE;AACF"}