mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-02 00:07:56 +01:00
Align chat color gradients to backup definitions
This commit is contained in:
@@ -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,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user