Eric Amodio пре 1 година
родитељ
комит
11f2e4f064
4 измењених фајлова са 22 додато и 34 уклоњено
  1. +2
    -2
      package.json
  2. +2
    -7
      src/annotations/annotations.ts
  3. +10
    -17
      src/system/color.ts
  4. +8
    -8
      yarn.lock

+ 2
- 2
package.json Прегледај датотеку

@ -12762,8 +12762,8 @@
"@vscode/codicons": "0.0.32",
"@vscode/webview-ui-toolkit": "1.2.1",
"ansi-regex": "6.0.1",
"billboard.js": "3.7.2",
"colorjs.io": "0.4.2",
"billboard.js": "3.7.3",
"colorjs.io": "0.4.3",
"https-proxy-agent": "5.0.1",
"iconv-lite": "0.6.3",
"lit": "2.3.1",

+ 2
- 7
src/annotations/annotations.ts Прегледај датотеку

@ -14,7 +14,7 @@ import { Colors, GlyphChars } from '../constants';
import type { CommitFormatOptions } from '../git/formatters/commitFormatter';
import { CommitFormatter } from '../git/formatters/commitFormatter';
import type { GitCommit } from '../git/models/commit';
import { steps, toRgba } from '../system/color';
import { interpolatespan> as interpolateColors, toRgba } from '../system/color';
import { getWidth, interpolate, pad } from '../system/string';
export interface ComputedHeatmap {
@ -66,12 +66,7 @@ export function getHeatmapColors() {
if (coldColor === defaultHeatmapColdColor && hotColor === defaultHeatmapHotColor) {
colors = defaultHeatmapColors;
} else {
colors = steps(hotColor, coldColor, {
space: 'xyz',
outputSpace: 'srgb',
steps: 20,
maxSteps: 20,
}).map(c => c.toString({ format: 'hex' }));
colors = interpolateColors(hotColor, coldColor, 20);
}
heatmapColors = {
hot: colors.slice(0, 10),

+ 10
- 17
src/system/color.ts Прегледај датотеку

@ -1,8 +1,4 @@
import type Color from 'colorjs.io';
import { steps as _steps } from 'colorjs.io/fn';
import type { ColorTypes } from 'colorjs.io/types/src/color';
import type { Methods } from 'colorjs.io/types/src/index-fn';
import type { RangeOptions } from 'colorjs.io/types/src/interpolation';
import { steps as interpolateSteps } from 'colorjs.io/fn';
const cssColorRegex =
/^(?:(#?)([0-9a-f]{3}|[0-9a-f]{6})|((?:rgb|hsl)a?)\((-?\d+%?)[,\s]+(-?\d+%?)[,\s]+(-?\d+%?)[,\s]*(-?[\d.]+%?)?\))$/i;
@ -18,6 +14,15 @@ export function darken(color: string, percentage: number) {
return lighten(color, -percentage);
}
export function interpolate(color1: string, color2: string, steps: number): string[] {
return interpolateSteps(color1, color2, {
space: 'xyz',
outputSpace: 'srgb',
steps: steps,
maxSteps: steps,
}).map(c => c.toString({ format: 'hex' }));
}
export function lighten(color: string, percentage: number) {
const rgba = toRgba(color);
if (rgba == null) return color;
@ -52,18 +57,6 @@ const mixChannel = (channel1: number, channel2: number, percentage: number) => {
return channel1 + ((channel2 - channel1) * percentage) / 100;
};
interface StepsOptions extends RangeOptions {
maxDeltaE?: number | undefined;
deltaEMethod?: Methods | undefined;
steps?: number | undefined;
maxSteps?: number | undefined;
}
export function steps(color1: ColorTypes, color2: ColorTypes, options?: StepsOptions): Color[] {
type Steps = (color1: ColorTypes, color2: ColorTypes, options?: StepsOptions) => Color[];
return (_steps as Steps)(color1, color2, options);
}
export function toRgba(color: string) {
color = color.trim();

+ 8
- 8
yarn.lock Прегледај датотеку

@ -1489,10 +1489,10 @@ big.js@^5.2.2:
resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328"
integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==
billboard.js@3.7.2:
version "3.7.2"
resolved "https://registry.yarnpkg.com/billboard.js/-/billboard.js-3.7.2.tgz#a5ecff1aad3bf0f3bc3064e1c342b9e8cd359915"
integrity sha512-Ud81dKw7SgaOVCkRqGmEYXn0SBY7Q0CFk5UPftkBa+62DzOF0ti7loHslkLMQkPv5RydSJuB6zl0IXkWWKuIJw==
billboard.js@3.7.3:
version "3.7.3"
resolved "https://registry.yarnpkg.com/billboard.js/-/billboard.js-3.7.3.tgz#fc1b7a8e9b046eb9d41aefbb098384ccd2cc3f7d"
integrity sha512-zic7Nts43/IyaoIbtij0eIJzq9wSRsyh8jpQx16hSbFnMDB82dePoA3zjY3dFOsU54BuOT5X1NtQISWhFjp8rA==
dependencies:
"@types/d3-selection" "^3.0.4"
"@types/d3-transition" "^3.0.3"
@ -1980,10 +1980,10 @@ colorette@^2.0.14:
resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.19.tgz#cdf044f47ad41a0f4b56b3a0d5b4e6e1a2d5a798"
integrity sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==
colorjs.io@0.4.2:
version "0.4.2"
resolved "https://registry.yarnpkg.com/colorjs.io/-/colorjs.io-0.4.2.tgz#5338fc185a8be3b46674420cd2be88389a18145b"
integrity sha512-vtpiH+BTzZtzs4Yno0GyoC05Z20fTeLwNJ7lQzjxi8GJJb1SZO2o5yUBAUXzgvrO2JNuyIqur4gb1Z6HBjpd9A==
colorjs.io@0.4.3:
version "0.4.3"
resolved "https://registry.yarnpkg.com/colorjs.io/-/colorjs.io-0.4.3.tgz#0f12aca97508d7db8f53ed304d28f079b3b3fff5"
integrity sha512-Jr6NiWFZCuSECl23Bhe4jvDldQsE0ErnWrdl3xIUFy+Bkp0l8r5qt/iZlNH47/xxGP5izcyC8InjoUoI4Po+Pg==
commander@7, commander@^7.2.0:
version "7.2.0"

Loading…
Откажи
Сачувај