2021-01-07 18:06:09 +00:00
|
|
|
// Copyright 2018-2021 Signal Messenger, LLC
|
2020-10-30 20:34:04 +00:00
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2021-05-28 16:15:17 +00:00
|
|
|
import { AvatarColorType } from '../types/Colors';
|
2020-08-13 20:53:45 +00:00
|
|
|
|
2021-05-28 16:15:17 +00:00
|
|
|
export function migrateColor(color?: string): AvatarColorType {
|
2018-06-27 20:53:49 +00:00
|
|
|
switch (color) {
|
|
|
|
// These colors no longer exist
|
2018-09-26 00:26:06 +00:00
|
|
|
case 'orange':
|
|
|
|
case 'amber':
|
2021-05-28 16:15:17 +00:00
|
|
|
return 'vermilion';
|
2018-09-26 00:26:06 +00:00
|
|
|
case 'yellow':
|
2021-05-28 16:15:17 +00:00
|
|
|
return 'burlap';
|
2018-07-24 01:34:20 +00:00
|
|
|
case 'deep_purple':
|
2021-05-28 16:15:17 +00:00
|
|
|
return 'violet';
|
2018-06-27 20:53:49 +00:00
|
|
|
case 'light_blue':
|
|
|
|
return 'blue';
|
2018-09-26 00:26:06 +00:00
|
|
|
case 'cyan':
|
|
|
|
return 'teal';
|
2018-07-24 01:34:20 +00:00
|
|
|
case 'lime':
|
2021-05-28 16:15:17 +00:00
|
|
|
return 'wintergreen';
|
2018-06-27 20:53:49 +00:00
|
|
|
|
2021-05-28 16:15:17 +00:00
|
|
|
// Actual color names
|
2018-09-26 00:26:06 +00:00
|
|
|
case 'red':
|
2021-05-28 16:15:17 +00:00
|
|
|
return 'crimson';
|
2018-06-27 20:53:49 +00:00
|
|
|
case 'deep_orange':
|
2021-05-28 16:15:17 +00:00
|
|
|
return 'vermilion';
|
2018-09-26 00:26:06 +00:00
|
|
|
case 'brown':
|
2021-05-28 16:15:17 +00:00
|
|
|
return 'burlap';
|
2018-06-27 20:53:49 +00:00
|
|
|
case 'pink':
|
2021-05-28 16:15:17 +00:00
|
|
|
return 'plum';
|
2018-06-27 20:53:49 +00:00
|
|
|
case 'purple':
|
2021-05-28 16:15:17 +00:00
|
|
|
return 'violet';
|
2018-09-26 00:26:06 +00:00
|
|
|
case 'green':
|
2021-05-28 16:15:17 +00:00
|
|
|
return 'forest';
|
2018-09-26 00:26:06 +00:00
|
|
|
case 'light_green':
|
2021-05-28 16:15:17 +00:00
|
|
|
return 'wintergreen';
|
2018-09-26 00:26:06 +00:00
|
|
|
case 'blue_grey':
|
2021-05-28 16:15:17 +00:00
|
|
|
return 'steel';
|
2018-09-26 00:26:06 +00:00
|
|
|
case 'grey':
|
2021-05-28 16:15:17 +00:00
|
|
|
return 'steel';
|
|
|
|
|
|
|
|
// These can stay as they are
|
|
|
|
case 'blue':
|
|
|
|
case 'indigo':
|
|
|
|
case 'teal':
|
2020-04-15 21:39:48 +00:00
|
|
|
case 'ultramarine':
|
2018-06-27 20:53:49 +00:00
|
|
|
return color;
|
|
|
|
|
|
|
|
default:
|
2021-05-28 16:15:17 +00:00
|
|
|
return 'steel';
|
2018-06-27 20:53:49 +00:00
|
|
|
}
|
|
|
|
}
|