Align chat color gradients to backup definitions

This commit is contained in:
trevor-signal
2026-03-04 12:25:22 -05:00
committed by GitHub
parent f1bf48b069
commit a149309ae6
2 changed files with 14 additions and 4 deletions

View File

@@ -3347,12 +3347,17 @@ export class BackupExportStream extends Readable {
color.end.lightness
);
// Desktop uses a different angle convention than the backup proto. Our degrees
// rotate in the opposite direction (sadly!) and our start is shifted by 90
// degrees
const backupAngle = 360 - ((color.deg ?? 0) + 90);
result.push({
id,
gradient: {
colors: [start, end],
positions: [0, 1],
angle: color.deg,
angle: (backupAngle + 360) % 360,
},
});
}

View File

@@ -3944,16 +3944,21 @@ export class BackupImportStream extends Writable {
const start = color.gradient.colors.at(0);
const end = color.gradient.colors.at(-1);
const deg = color.gradient.angle;
const backupAngle = color.gradient.angle;
strictAssert(start != null, 'Missing start color');
strictAssert(end != null, 'Missing end color');
strictAssert(deg != null, 'Missing angle');
strictAssert(backupAngle != null, 'Missing angle');
// Desktop uses a different angle convention than the backup proto. Our degrees
// rotate in the opposite direction (sadly!) and our start is shifted by 90
// degrees
const desktopAngle = 360 - backupAngle - 90;
value = {
start: rgbIntToDesktopHSL(start),
end: rgbIntToDesktopHSL(end),
deg,
deg: (desktopAngle + 360) % 360,
};
} else {
log.error(