Align chat color gradients to backup definitions

Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
automated-signal
2026-03-04 11:39:11 -06:00
committed by GitHub
parent 822aaa19f9
commit 35319bdefc
2 changed files with 14 additions and 4 deletions

View File

@@ -3336,12 +3336,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

@@ -3914,16 +3914,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(