diff --git a/lib/shared/thread-utils.js b/lib/shared/thread-utils.js --- a/lib/shared/thread-utils.js +++ b/lib/shared/thread-utils.js @@ -95,9 +95,18 @@ '575757': 10, }; -const selectedThreadColors: $ReadOnlyArray = Object.keys( +const selectedThreadColors: $ReadOnlyArray = Object.entries( selectedThreadColorsObj, -); +) + .sort((a, b) => { + invariant( + typeof a[1] === 'number' && typeof b[1] === 'number', + 'values of selectedThreadColorsObj are of type number', + ); + return a[1] - b[1]; + }) + .map(each => each[0]); + export type SelectedThreadColors = $Keys; function generateRandomColor(): string {