Skip to content

Commit e6ad743

Browse files
authored
V7 primary colors (#2476)
* remove Colors.primary * remove themeColors * update test
1 parent 15ecaba commit e6ad743

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

src/style/__tests__/colors.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,10 @@ describe('style/Colors', () => {
212212
});
213213

214214
it('should return undefined for color that does not exist in our colors palette.', () => {
215+
uut.anotherViolet = '#5A48F5';
215216
expect(uut.getSystemColorByHex('#5A48F5')).toEqual('violet30');
216217
expect(uut.getSystemColorByHex('#5A48F5', GetColorsByHexOptions)).toEqual(undefined);
217-
expect(uut.getSystemColorByHex('#5A48F5', {validColors: [...SYSTEM_COLORS, 'primary']})).toEqual('primary');
218+
expect(uut.getSystemColorByHex('#5A48F5', {validColors: [...SYSTEM_COLORS, 'anotherViolet']})).toEqual('anotherViolet');
218219
});
219220
});
220221
});

src/style/colors.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import _ from 'lodash';
33
import Color from 'color';
44
import {OpaqueColorValue} from 'react-native';
55
import tinycolor from 'tinycolor2';
6-
import {colorsPalette, themeColors} from './colorsPalette';
6+
import {colorsPalette} from './colorsPalette';
77
import DesignTokens from './designTokens';
88
import DesignTokensDM from './designTokensDM';
99
//@ts-ignore
@@ -20,7 +20,7 @@ export class Colors {
2020
private shouldSupportDarkMode = false;
2121

2222
constructor() {
23-
const colors = Object.assign(colorsPalette, themeColors);
23+
const colors = Object.assign(colorsPalette);
2424
Object.assign(this, colors);
2525
this.loadSchemes({light: DesignTokens, dark: DesignTokensDM});
2626

@@ -185,7 +185,7 @@ export class Colors {
185185
const shouldReverseOnDark =
186186
!options?.avoidReverseOnDark && this.shouldSupportDarkMode && Scheme.getSchemeType() === 'dark';
187187
const key = shouldReverseOnDark ? colorKeys[colorKeys.length - 1 - keyIndex] : tintKey;
188-
188+
189189
const requiredColorKey = `${colorKey.slice(0, -2)}${key}`;
190190
const requiredColorKey1 = `${colorKey.slice(0, -1)}${key}`;
191191
const requiredColor = this[requiredColorKey] || this[requiredColorKey1];
@@ -355,10 +355,7 @@ function threeDigitHexToSix(value: string) {
355355
return value.replace(/./g, '$&$&');
356356
}
357357

358-
const TypedColors = Colors as ExtendTypeWith<
359-
typeof Colors,
360-
typeof colorsPalette & typeof themeColors & typeof DesignTokens
361-
>;
358+
const TypedColors = Colors as ExtendTypeWith<typeof Colors, typeof colorsPalette & typeof DesignTokens>;
362359
const colorObject = new TypedColors();
363360
colorObject.loadColors(colorsPalette);
364361
export default colorObject;

src/style/colorsPalette.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,4 @@ const extraFixColorsMap = {
111111
'#fff': 'white'
112112
};
113113

114-
const themeColors = {
115-
primary: colorsPalette.violet30
116-
};
117-
118-
export {colorsPalette, themeColors, extraFixColorsMap};
114+
export {colorsPalette, extraFixColorsMap};

0 commit comments

Comments
 (0)