|
|
@ -324,26 +324,6 @@ export class GraphApp extends App { |
|
|
|
} |
|
|
|
|
|
|
|
protected override onThemeUpdated(e: ThemeChangeEvent) { |
|
|
|
const backgroundColor = Color.from(e.colors.background); |
|
|
|
const backgroundLuminance = backgroundColor.getRelativeLuminance(); |
|
|
|
|
|
|
|
const foregroundColor = Color.from(e.colors.foreground); |
|
|
|
const foregroundLuminance = foregroundColor.getRelativeLuminance(); |
|
|
|
|
|
|
|
const themeLuminance = (luminance: number) => { |
|
|
|
let min; |
|
|
|
let max; |
|
|
|
if (foregroundLuminance > backgroundLuminance) { |
|
|
|
max = foregroundLuminance; |
|
|
|
min = backgroundLuminance; |
|
|
|
} else { |
|
|
|
min = foregroundLuminance; |
|
|
|
max = backgroundLuminance; |
|
|
|
} |
|
|
|
const percent = luminance / 1; |
|
|
|
return percent * (max - min) + min; |
|
|
|
}; |
|
|
|
|
|
|
|
const bodyStyle = document.body.style; |
|
|
|
bodyStyle.setProperty('--graph-theme-opacity-factor', e.isLightTheme ? '0.5' : '1'); |
|
|
|
|
|
|
@ -364,129 +344,151 @@ export class GraphApp extends App { |
|
|
|
'--color-graph-background2', |
|
|
|
e.isLightTheme ? darken(e.colors.background, 10) : lighten(e.colors.background, 10), |
|
|
|
); |
|
|
|
let color = e.computedStyle.getPropertyValue('--vscode-list-focusOutline').trim(); |
|
|
|
bodyStyle.setProperty('--color-graph-contrast-border', color); |
|
|
|
color = e.computedStyle.getPropertyValue('--vscode-list-activeSelectionBackground').trim(); |
|
|
|
bodyStyle.setProperty('--color-graph-selected-row', color); |
|
|
|
color = e.computedStyle.getPropertyValue('--vscode-list-hoverBackground').trim(); |
|
|
|
bodyStyle.setProperty('--color-graph-hover-row', color); |
|
|
|
color = e.computedStyle.getPropertyValue('--vscode-list-activeSelectionForeground').trim(); |
|
|
|
bodyStyle.setProperty('--color-graph-text-selected-row', color); |
|
|
|
|
|
|
|
const color = e.computedStyle.getPropertyValue('--color-graph-text-selected-row').trim(); |
|
|
|
bodyStyle.setProperty('--color-graph-text-dimmed-selected', opacity(color, 50)); |
|
|
|
bodyStyle.setProperty('--color-graph-text-dimmed', opacity(e.colors.foreground, 20)); |
|
|
|
color = e.computedStyle.getPropertyValue('--vscode-list-hoverForeground').trim(); |
|
|
|
bodyStyle.setProperty('--color-graph-text-hovered', color); |
|
|
|
bodyStyle.setProperty('--color-graph-text-selected', e.colors.foreground); |
|
|
|
|
|
|
|
bodyStyle.setProperty('--color-graph-text-normal', opacity(e.colors.foreground, 85)); |
|
|
|
bodyStyle.setProperty('--color-graph-text-secondary', opacity(e.colors.foreground, 65)); |
|
|
|
bodyStyle.setProperty('--color-graph-text-disabled', opacity(e.colors.foreground, 50)); |
|
|
|
|
|
|
|
// minimap and scroll markers
|
|
|
|
const backgroundColor = Color.from(e.colors.background); |
|
|
|
const foregroundColor = Color.from(e.colors.foreground); |
|
|
|
|
|
|
|
const resultColor = Color.fromHex('#ffff00'); |
|
|
|
const headColor = Color.fromHex('#00ff00'); |
|
|
|
const branchColor = Color.fromHex('#ff7f50'); |
|
|
|
const tagColor = Color.fromHex('#15a0bf'); |
|
|
|
const stashColor = Color.fromHex('#800080'); |
|
|
|
const backgroundLuminance = backgroundColor.getRelativeLuminance(); |
|
|
|
const foregroundLuminance = foregroundColor.getRelativeLuminance(); |
|
|
|
|
|
|
|
color = e.computedStyle.getPropertyValue('--vscode-progressBar-background').trim(); |
|
|
|
const activityColor = Color.from(color); |
|
|
|
// bodyStyle.setProperty('--color-graph-minimap-line0', color);
|
|
|
|
bodyStyle.setProperty('--color-graph-minimap-line0', activityColor.luminance(themeLuminance(0.5)).toString()); |
|
|
|
const themeLuminance = (luminance: number) => { |
|
|
|
let min; |
|
|
|
let max; |
|
|
|
if (foregroundLuminance > backgroundLuminance) { |
|
|
|
max = foregroundLuminance; |
|
|
|
min = backgroundLuminance; |
|
|
|
} else { |
|
|
|
min = foregroundLuminance; |
|
|
|
max = backgroundLuminance; |
|
|
|
} |
|
|
|
const percent = luminance / 1; |
|
|
|
return percent * (max - min) + min; |
|
|
|
}; |
|
|
|
|
|
|
|
bodyStyle.setProperty( |
|
|
|
'--color-graph-minimap-focusLine', |
|
|
|
backgroundColor.luminance(themeLuminance(e.isLightTheme ? 0.6 : 0.2)).toString(), |
|
|
|
); |
|
|
|
// minimap and scroll markers
|
|
|
|
|
|
|
|
color = e.computedStyle.getPropertyValue('--vscode-scrollbarSlider-background').trim(); |
|
|
|
let c = Color.fromCssVariable('--color-graph-minimap-visibleAreaBackground', e.computedStyle); |
|
|
|
bodyStyle.setProperty( |
|
|
|
'--color-graph-minimap-visibleAreaBackground', |
|
|
|
Color.from(color) |
|
|
|
.luminance(themeLuminance(e.isLightTheme ? 0.6 : 0.15)) |
|
|
|
.toString(), |
|
|
|
c.luminance(themeLuminance(e.isLightTheme ? 0.6 : 0.1)).toString(), |
|
|
|
); |
|
|
|
|
|
|
|
color = e.computedStyle.getPropertyValue('--vscode-scrollbarSlider-hoverBackground').trim(); |
|
|
|
bodyStyle.setProperty( |
|
|
|
'--color-graph-minimap-visibleAreaHoverBackground', |
|
|
|
Color.from(color) |
|
|
|
.luminance(themeLuminance(e.isLightTheme ? 0.6 : 0.15)) |
|
|
|
.toString(), |
|
|
|
); |
|
|
|
if (!e.isLightTheme) { |
|
|
|
c = Color.fromCssVariable('--color-graph-minimap-tip-headForeground', e.computedStyle); |
|
|
|
bodyStyle.setProperty('--color-graph-minimap-tip-headForeground', c.opposite().toString()); |
|
|
|
|
|
|
|
color = Color.from(e.computedStyle.getPropertyValue('--vscode-list-activeSelectionBackground').trim()) |
|
|
|
.luminance(themeLuminance(e.isLightTheme ? 0.45 : 0.32)) |
|
|
|
.toString(); |
|
|
|
// color = e.computedStyle.getPropertyValue('--vscode-editorCursor-foreground').trim();
|
|
|
|
bodyStyle.setProperty('--color-graph-minimap-selectedMarker', color); |
|
|
|
bodyStyle.setProperty('--color-graph-scroll-marker-selection', color); |
|
|
|
bodyStyle.setProperty('--color-graph-minimap-highlightedMarker', opacity(color, 60)); |
|
|
|
c = Color.fromCssVariable('--color-graph-minimap-tip-upstreamForeground', e.computedStyle); |
|
|
|
bodyStyle.setProperty('--color-graph-minimap-tip-upstreamForeground', c.opposite().toString()); |
|
|
|
|
|
|
|
bodyStyle.setProperty( |
|
|
|
'--color-graph-minimap-resultMarker', |
|
|
|
resultColor.luminance(themeLuminance(0.6)).toString(), |
|
|
|
); |
|
|
|
bodyStyle.setProperty( |
|
|
|
'--color-graph-scroll-marker-highlights', |
|
|
|
resultColor.luminance(themeLuminance(0.6)).toString(), |
|
|
|
); |
|
|
|
|
|
|
|
const pillLabel = foregroundColor.luminance(themeLuminance(e.isLightTheme ? 0 : 1)).toString(); |
|
|
|
const headBackground = headColor.luminance(themeLuminance(e.isLightTheme ? 0.9 : 0.2)).toString(); |
|
|
|
const headBorder = headColor.luminance(themeLuminance(e.isLightTheme ? 0.2 : 0.4)).toString(); |
|
|
|
const headMarker = headColor.luminance(themeLuminance(0.5)).toString(); |
|
|
|
|
|
|
|
bodyStyle.setProperty('--color-graph-minimap-headBackground', headBackground); |
|
|
|
bodyStyle.setProperty('--color-graph-minimap-headBorder', headBorder); |
|
|
|
bodyStyle.setProperty('--color-graph-minimap-headForeground', pillLabel); |
|
|
|
bodyStyle.setProperty('--color-graph-minimap-headMarker', opacity(headMarker, 80)); |
|
|
|
bodyStyle.setProperty('--color-graph-scroll-marker-head', opacity(headMarker, 90)); |
|
|
|
|
|
|
|
bodyStyle.setProperty('--color-graph-minimap-upstreamBackground', headBackground); |
|
|
|
bodyStyle.setProperty('--color-graph-minimap-upstreamBorder', headBorder); |
|
|
|
bodyStyle.setProperty('--color-graph-minimap-upstreamForeground', pillLabel); |
|
|
|
bodyStyle.setProperty('--color-graph-minimap-upstreamMarker', opacity(headMarker, 60)); |
|
|
|
bodyStyle.setProperty('--color-graph-scroll-marker-upstream', opacity(headMarker, 60)); |
|
|
|
|
|
|
|
const branchBackground = branchColor.luminance(themeLuminance(e.isLightTheme ? 0.8 : 0.3)).toString(); |
|
|
|
const branchBorder = branchColor.luminance(themeLuminance(e.isLightTheme ? 0.2 : 0.4)).toString(); |
|
|
|
const branchMarker = branchColor.luminance(themeLuminance(0.6)).toString(); |
|
|
|
|
|
|
|
bodyStyle.setProperty('--color-graph-minimap-branchBackground', branchBackground); |
|
|
|
bodyStyle.setProperty('--color-graph-minimap-branchBorder', branchBorder); |
|
|
|
bodyStyle.setProperty('--color-graph-minimap-branchForeground', pillLabel); |
|
|
|
bodyStyle.setProperty('--color-graph-minimap-branchMarker', opacity(branchMarker, 70)); |
|
|
|
bodyStyle.setProperty('--color-graph-scroll-marker-local-branches', opacity(branchMarker, 90)); |
|
|
|
|
|
|
|
bodyStyle.setProperty('--color-graph-minimap-remoteBackground', opacity(branchBackground, 80)); |
|
|
|
bodyStyle.setProperty('--color-graph-minimap-remoteBorder', opacity(branchBorder, 80)); |
|
|
|
bodyStyle.setProperty('--color-graph-minimap-remoteForeground', pillLabel); |
|
|
|
bodyStyle.setProperty('--color-graph-minimap-remoteMarker', opacity(branchMarker, 30)); |
|
|
|
bodyStyle.setProperty('--color-graph-scroll-marker-remote-branches', opacity(branchMarker, 60)); |
|
|
|
|
|
|
|
bodyStyle.setProperty( |
|
|
|
'--color-graph-minimap-tagBackground', |
|
|
|
tagColor.luminance(themeLuminance(e.isLightTheme ? 0.8 : 0.2)).toString(), |
|
|
|
); |
|
|
|
bodyStyle.setProperty( |
|
|
|
'--color-graph-minimap-tagBorder', |
|
|
|
tagColor.luminance(themeLuminance(e.isLightTheme ? 0.2 : 0.4)).toString(), |
|
|
|
); |
|
|
|
bodyStyle.setProperty('--color-graph-minimap-tagForeground', pillLabel); |
|
|
|
bodyStyle.setProperty( |
|
|
|
'--color-graph-minimap-tagMarker', |
|
|
|
opacity(tagColor.luminance(themeLuminance(0.5)).toString(), 60), |
|
|
|
); |
|
|
|
bodyStyle.setProperty( |
|
|
|
'--color-graph-scroll-marker-tags', |
|
|
|
opacity(tagColor.luminance(themeLuminance(0.9)).toString(), 90), |
|
|
|
); |
|
|
|
c = Color.fromCssVariable('--color-graph-minimap-tip-branchForeground', e.computedStyle); |
|
|
|
bodyStyle.setProperty('--color-graph-minimap-tip-branchForeground', c.opposite().toString()); |
|
|
|
} |
|
|
|
|
|
|
|
bodyStyle.setProperty( |
|
|
|
'--color-graph-scroll-marker-stashes', |
|
|
|
opacity(stashColor.luminance(themeLuminance(0.9)).toString(), 90), |
|
|
|
); |
|
|
|
// const highlightsColor = Color.from(
|
|
|
|
// e.computedStyle.getPropertyValue('--color-graph-scroll-marker-highlights').trim(),
|
|
|
|
// );
|
|
|
|
// const branchColor = Color.from(
|
|
|
|
// e.computedStyle.getPropertyValue('--color-graph-scroll-marker-local-branches').trim(),
|
|
|
|
// );
|
|
|
|
// const remoteBranchColor = Color.from(
|
|
|
|
// e.computedStyle.getPropertyValue('--color-graph-scroll-marker-remote-branches').trim(),
|
|
|
|
// );
|
|
|
|
// const stashColor = Color.from(e.computedStyle.getPropertyValue('--color-graph-scroll-marker-stashes').trim());
|
|
|
|
// const tagColor = Color.from(e.computedStyle.getPropertyValue('--color-graph-scroll-marker-tags').trim());
|
|
|
|
|
|
|
|
// color = e.computedStyle.getPropertyValue('--vscode-progressBar-background').trim();
|
|
|
|
// const activityColor = Color.from(color);
|
|
|
|
// bodyStyle.setProperty('--color-graph-minimap-line0', activityColor.luminance(themeLuminance(0.5)).toString());
|
|
|
|
|
|
|
|
// bodyStyle.setProperty(
|
|
|
|
// '--color-graph-minimap-focusLine',
|
|
|
|
// backgroundColor.luminance(themeLuminance(e.isLightTheme ? 0.6 : 0.2)).toString(),
|
|
|
|
// );
|
|
|
|
|
|
|
|
// color = e.computedStyle.getPropertyValue('--vscode-scrollbarSlider-background').trim();
|
|
|
|
// bodyStyle.setProperty(
|
|
|
|
// '--color-graph-minimap-visibleAreaBackground',
|
|
|
|
// Color.from(color)
|
|
|
|
// .luminance(themeLuminance(e.isLightTheme ? 0.6 : 0.15))
|
|
|
|
// .toString(),
|
|
|
|
// );
|
|
|
|
|
|
|
|
// bodyStyle.setProperty(
|
|
|
|
// '--color-graph-scroll-marker-highlights',
|
|
|
|
// highlightsColor.luminance(themeLuminance(e.isLightTheme ? 0.6 : 1.0)).toString(),
|
|
|
|
// );
|
|
|
|
|
|
|
|
// const pillLabel = foregroundColor.luminance(themeLuminance(e.isLightTheme ? 0 : 1)).toString();
|
|
|
|
// const headBackground = headColor.luminance(themeLuminance(e.isLightTheme ? 0.9 : 0.2)).toString();
|
|
|
|
// const headBorder = headColor.luminance(themeLuminance(e.isLightTheme ? 0.2 : 0.4)).toString();
|
|
|
|
// const headMarker = headColor.luminance(themeLuminance(0.5)).toString();
|
|
|
|
|
|
|
|
// bodyStyle.setProperty('--color-graph-minimap-headBackground', headBackground);
|
|
|
|
// bodyStyle.setProperty('--color-graph-minimap-headBorder', headBorder);
|
|
|
|
// bodyStyle.setProperty('--color-graph-minimap-headForeground', pillLabel);
|
|
|
|
|
|
|
|
// bodyStyle.setProperty('--color-graph-scroll-marker-head', opacity(headMarker, 90));
|
|
|
|
|
|
|
|
// bodyStyle.setProperty('--color-graph-minimap-upstreamBackground', headBackground);
|
|
|
|
// bodyStyle.setProperty('--color-graph-minimap-upstreamBorder', headBorder);
|
|
|
|
// bodyStyle.setProperty('--color-graph-minimap-upstreamForeground', pillLabel);
|
|
|
|
// bodyStyle.setProperty('--color-graph-scroll-marker-upstream', opacity(headMarker, 60));
|
|
|
|
|
|
|
|
// const branchBackground = branchColor.luminance(themeLuminance(e.isLightTheme ? 0.8 : 0.3)).toString();
|
|
|
|
// const branchBorder = branchColor.luminance(themeLuminance(e.isLightTheme ? 0.2 : 0.4)).toString();
|
|
|
|
// const branchMarker = branchColor.luminance(themeLuminance(e.isLightTheme ? 0.2 : 0.6)).toString();
|
|
|
|
|
|
|
|
// bodyStyle.setProperty('--color-graph-minimap-branchBackground', branchBackground);
|
|
|
|
// bodyStyle.setProperty('--color-graph-minimap-branchBorder', branchBorder);
|
|
|
|
// bodyStyle.setProperty('--color-graph-minimap-branchForeground', pillLabel);
|
|
|
|
// bodyStyle.setProperty('--color-graph-scroll-marker-local-branches', opacity(branchMarker, 90));
|
|
|
|
|
|
|
|
// const remoteBranchBackground = remoteBranchColor
|
|
|
|
// .luminance(themeLuminance(e.isLightTheme ? 0.8 : 0.3))
|
|
|
|
// .toString();
|
|
|
|
// const remoteBranchBorder = remoteBranchColor.luminance(themeLuminance(e.isLightTheme ? 0.2 : 0.4)).toString();
|
|
|
|
// const remoteBranchMarker = remoteBranchColor.luminance(themeLuminance(e.isLightTheme ? 0.3 : 0.6)).toString();
|
|
|
|
|
|
|
|
// bodyStyle.setProperty('--color-graph-minimap-remoteBackground', opacity(remoteBranchBackground, 80));
|
|
|
|
// bodyStyle.setProperty('--color-graph-minimap-remoteBorder', opacity(remoteBranchBorder, 80));
|
|
|
|
// bodyStyle.setProperty('--color-graph-minimap-remoteForeground', pillLabel);
|
|
|
|
// bodyStyle.setProperty('--color-graph-scroll-marker-remote-branches', opacity(remoteBranchMarker, 70));
|
|
|
|
|
|
|
|
// bodyStyle.setProperty(
|
|
|
|
// '--color-graph-minimap-stashBackground',
|
|
|
|
// stashColor.luminance(themeLuminance(e.isLightTheme ? 0.8 : 0.2)).toString(),
|
|
|
|
// );
|
|
|
|
// bodyStyle.setProperty(
|
|
|
|
// '--color-graph-minimap-stashBorder',
|
|
|
|
// stashColor.luminance(themeLuminance(e.isLightTheme ? 0.2 : 0.4)).toString(),
|
|
|
|
// );
|
|
|
|
// bodyStyle.setProperty('--color-graph-minimap-stashForeground', pillLabel);
|
|
|
|
// bodyStyle.setProperty(
|
|
|
|
// '--color-graph-scroll-marker-stashes',
|
|
|
|
// opacity(stashColor.luminance(themeLuminance(e.isLightTheme ? 0.5 : 0.9)).toString(), 90),
|
|
|
|
// );
|
|
|
|
|
|
|
|
// bodyStyle.setProperty(
|
|
|
|
// '--color-graph-minimap-tagBackground',
|
|
|
|
// tagColor.luminance(themeLuminance(e.isLightTheme ? 0.8 : 0.2)).toString(),
|
|
|
|
// );
|
|
|
|
// bodyStyle.setProperty(
|
|
|
|
// '--color-graph-minimap-tagBorder',
|
|
|
|
// tagColor.luminance(themeLuminance(e.isLightTheme ? 0.2 : 0.4)).toString(),
|
|
|
|
// );
|
|
|
|
// bodyStyle.setProperty('--color-graph-minimap-tagForeground', pillLabel);
|
|
|
|
// bodyStyle.setProperty(
|
|
|
|
// '--color-graph-scroll-marker-tags',
|
|
|
|
// opacity(tagColor.luminance(themeLuminance(e.isLightTheme ? 0.3 : 0.5)).toString(), 60),
|
|
|
|
// );
|
|
|
|
|
|
|
|
if (e.isInitializing) return; |
|
|
|
|
|
|
|