Skip to content

Commit

Permalink
Add new 'base' color in themes (#977)
Browse files Browse the repository at this point in the history
* Add new `base` color to default themes

* Update 'brand' usage to be 'base'
  • Loading branch information
YoussefHenna authored Dec 18, 2024
1 parent 8c34b84 commit 1dba828
Show file tree
Hide file tree
Showing 36 changed files with 64 additions and 61 deletions.
4 changes: 2 additions & 2 deletions example/src/AccordionExample.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Section, { Container } from "./Section";

function AccordionExample({ theme }) {
return (
<Container style={{ backgroundColor: theme.colors.background.brand }}>
<Container style={{ backgroundColor: theme.colors.background.base }}>
<Section title="Basic accordion with no additional styles">
<AccordionGroup label={"Basic"}>
<Text>Item 1</Text>
Expand All @@ -30,7 +30,7 @@ function AccordionExample({ theme }) {
<AccordionGroup
openColor={theme.colors.branding.primary}
closedColor={theme.colors.branding.secondary}
caretColor={theme.colors.border.brand}
caretColor={theme.colors.border.base}
icon={"folder"}
iconSize={26}
style={{ fontWeight: "normal" }}
Expand Down
2 changes: 1 addition & 1 deletion example/src/ActionSheetExample.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function ActionSheetExample({ theme }) {
}, []);

return (
<Container style={{ backgroundColor: theme.colors.background.brand }}>
<Container style={{ backgroundColor: theme.colors.background.base }}>
<Section title="Action Sheet">
<ButtonSolid title="Open Action Sheet" onPress={showActionSheet} />
<ActionSheet visible={visible} onClose={hideActionSheet}>
Expand Down
8 changes: 4 additions & 4 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ const DarkTheme = createTheme({
name: "DarkTheme",
colors: {
background: {
brand: "#404040",
base: "#404040",
},
text: {
normal: "white",
Expand Down Expand Up @@ -221,14 +221,14 @@ const OtherTheme = createTheme({
secondary: "#824D74",
},
background: {
brand: "black",
base: "black",
},
text: {
strong: "white",
normal: "white",
},
border: {
brand: "#FDAF7B",
base: "#FDAF7B",
},
},
typography: {
Expand Down Expand Up @@ -358,7 +358,7 @@ function Example({ title, children }: ExampleProps) {
hasTopSafeArea={true}
hasBottomSafeArea={true}
scrollable={false}
style={{ backgroundColor: theme.colors.background.brand }}
style={{ backgroundColor: theme.colors.background.base }}
>
<View
style={[
Expand Down
2 changes: 1 addition & 1 deletion example/src/DatePickerExample.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function DatePickerExample({ theme }) {
const [date3, setDate3] = React.useState(new Date());

return (
<Container style={{ backgroundColor: theme.colors.background.brand }}>
<Container style={{ backgroundColor: theme.colors.background.base }}>
<Section title="Underline">
<DatePicker
label="Date (without date prop)"
Expand Down
6 changes: 3 additions & 3 deletions example/src/SliderExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function SliderExample({ theme }) {
const handleChange = (v) => setValue(v);

return (
<Container style={{ backgroundColor: theme.colors.background.brand }}>
<Container style={{ backgroundColor: theme.colors.background.base }}>
<Section title="Uncontrolled">
<Slider
onValueChange={console.log}
Expand All @@ -28,7 +28,7 @@ function SliderExample({ theme }) {
<Section title="Controlled">
<Slider
step={10}
maximumTrackTintColor={theme.colors.foreground.brand}
maximumTrackTintColor={theme.colors.foreground.base}
minimumTrackTintColor={theme.colors.branding.primary}
thumbTintColor={theme.colors.branding.primary}
value={value}
Expand All @@ -43,7 +43,7 @@ function SliderExample({ theme }) {
<Section title="Controlled with initial value">
<Slider
step={10}
maximumTrackTintColor={theme.colors.foreground.brand}
maximumTrackTintColor={theme.colors.foreground.base}
minimumTrackTintColor={theme.colors.branding.primary}
thumbTintColor={theme.colors.branding.primary}
value={value2}
Expand Down
2 changes: 1 addition & 1 deletion example/src/StarRatingExample.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function StarRatingExample({ theme }) {
const [rating, setRating] = React.useState(0.5);

return (
<Container style={{ backgroundColor: theme.colors.background.brand }}>
<Container style={{ backgroundColor: theme.colors.background.base }}>
<Section title="Star Rating">
<StarRating rating={3.5} />
</Section>
Expand Down
2 changes: 1 addition & 1 deletion example/src/StepperExample.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function StepperExample({ theme }) {
const handleChange = (v) => setValue(v);

return (
<Container style={{ backgroundColor: theme.colors.background.brand }}>
<Container style={{ backgroundColor: theme.colors.background.base }}>
<Section title="With State">
<Stepper value={value} onChange={handleChange} />
</Section>
Expand Down
2 changes: 1 addition & 1 deletion example/src/SurfaceExample.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Section, { Container } from "./Section";

function SurfaceExample({ theme }) {
return (
<Container style={{ backgroundColor: theme.colors.background.brand }}>
<Container style={{ backgroundColor: theme.colors.background.base }}>
<Section title="overflow: 'hidden', backgroundColor: 'pink'">
<Surface
style={{
Expand Down
2 changes: 1 addition & 1 deletion example/src/SwitchExample.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function SwitchExample({ theme }) {
const handleChange = (v) => toggle(v);

return (
<Container style={{ backgroundColor: theme.colors.background.brand }}>
<Container style={{ backgroundColor: theme.colors.background.base }}>
<Section title="Enabled">
<Switch value={value} disabled={false} onValueChange={handleChange} />
</Section>
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/components/BottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
) => {
const theme = useTheme();
const backgroundColor =
(style as ViewStyle)?.backgroundColor || theme.colors.background.brand;
(style as ViewStyle)?.backgroundColor || theme.colors.background.base;

const snapPoints = snapPointsProp ?? [
topSnapPosition,
Expand Down Expand Up @@ -102,15 +102,15 @@ const BottomSheet = React.forwardRef<BottomSheetComponent, BottomSheetProps>(
: getSnapIndexFromPosition(initialSnapPosition)
}
handleIndicatorStyle={[
{ backgroundColor: handleColor ?? theme.colors.border.brand },
{ backgroundColor: handleColor ?? theme.colors.border.base },
!showHandle ? { display: "none" } : {},
]}
backgroundStyle={{
backgroundColor,
borderTopLeftRadius: topBorderRadius,
borderTopRightRadius: topBorderRadius,
borderWidth,
borderColor: borderColor ?? theme.colors.border.brand,
borderColor: borderColor ?? theme.colors.border.base,
}}
onChange={(index) =>
// Convert bottom-sheet index to match our top-to-bottom ordering
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/components/DatePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,17 +269,17 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({

inputTextColor = colors.text.strong;
if (disabled) {
activeColor = colors.border.brand;
activeColor = colors.border.base;
placeholderColor = colors.text.light;
borderColor = "transparent";
underlineColor = "transparent";
backgroundColor = colors.border.brand;
backgroundColor = colors.border.base;
} else {
activeColor = inputBorderColorActive || colors.branding.primary;
placeholderColor = colors.text.light;
underlineColor =
viewStyles.borderColor ?? inputBorderColor ?? colors.border.brand;
backgroundColor = colors.background.brand;
viewStyles.borderColor ?? inputBorderColor ?? colors.border.base;
backgroundColor = colors.background.base;
}

const { lineHeight, ...subtitle1 } = typography.subtitle1;
Expand Down Expand Up @@ -562,7 +562,7 @@ const DatePicker: React.FC<React.PropsWithChildren<Props>> = ({
style={[
styles.picker,
{
backgroundColor: colors.border.brand,
backgroundColor: colors.border.base,
},
]}
>
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/components/DeckSwiper/DeckSwiperCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const DeckSwiperCard: React.FC<
style={[
styles.card,
{
backgroundColor: theme.colors.background.brand,
borderColor: theme.colors.border.brand,
backgroundColor: theme.colors.background.base,
borderColor: theme.colors.border.base,
},
style,
]}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/Divider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const Divider: React.FC<React.PropsWithChildren<Props>> = ({
<View
style={[
{
backgroundColor: color || colors.border.brand,
backgroundColor: color || colors.border.base,
height: StyleSheet.hairlineWidth,
},
style,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/Elevation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const Elevation: React.FC<React.PropsWithChildren<Props>> = ({
style={[
{
borderRadius,
backgroundColor: colors.background.brand,
backgroundColor: colors.background.base,
},
elevation ? { elevation } : null,
style,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ const AudioPlayerWithInterface = React.forwardRef<
testID="audio-player-interface"
style={[
{
backgroundColor: theme.colors.background.brand,
borderColor: theme.colors.border.brand,
backgroundColor: theme.colors.background.base,
borderColor: theme.colors.border.base,
},
styles.container,
viewStyles,
Expand Down Expand Up @@ -166,7 +166,7 @@ const AudioPlayerWithInterface = React.forwardRef<
completedTrackColor ?? theme.colors.branding.primary
}
maximumTrackTintColor={
remainingTrackColor ?? theme.colors.border.brand
remainingTrackColor ?? theme.colors.border.base
}
thumbTintColor={thumbColor ?? theme.colors.branding.primary}
minimumValue={0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const ModalPicker: React.FC<
selectedIconName = "Feather/check",
selectedIconColor = theme.colors.text.strong,
selectedIconSize = 20,
dropDownBackgroundColor = theme.colors.background.brand,
dropDownBorderColor = theme.colors.border.brand,
dropDownBackgroundColor = theme.colors.background.base,
dropDownBorderColor = theme.colors.border.base,
dropDownTextColor = theme.colors.text.strong,
dropDownBorderWidth = 1,
dropDownBorderRadius = 8,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const DropDownPicker: React.FC<
selectedIconName = "Feather/check",
selectedIconColor = theme.colors.text.strong,
selectedIconSize = 20,
dropDownBackgroundColor = theme.colors.background.brand,
dropDownBorderColor = theme.colors.border.brand,
dropDownBackgroundColor = theme.colors.background.base,
dropDownBorderColor = theme.colors.border.base,
dropDownTextColor = theme.colors.text.strong,
dropDownBorderWidth = 1,
dropDownBorderRadius = 8,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/PinInput/PinInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const PinInput = React.forwardRef<NativeTextInput, PinInputProps>(
testID="default-code-input-cell"
style={[
styles.cell,
{ borderColor: theme.colors.border.brand },
{ borderColor: theme.colors.border.base },
viewStyles,
isFocused && focusedBorderWidth
? { borderWidth: focusedBorderWidth }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const CircularProgress: React.FC<
thickness = 10,
trackThickness = thickness,
color = theme.colors.branding.primary,
trackColor = theme.colors.border.brand,
trackColor = theme.colors.border.base,
trackOpacity = 1,
showTrack = true,
animationDuration = DEFAULT_ANIMATION_DURATION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const LinearProgress: React.FC<ValueProgressProps> = ({
thickness = 10,
trackThickness = thickness,
color = theme.colors.branding.primary,
trackColor = theme.colors.border.brand,
trackColor = theme.colors.border.base,
trackOpacity = 1,
showTrack = true,
animationDuration = DEFAULT_ANIMATION_DURATION,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/ScreenContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function ScreenContainer({
...rest
}: ScreenContainerProps) {
const backgroundColor =
StyleSheet.flatten(style)?.backgroundColor || theme.colors.background.brand;
StyleSheet.flatten(style)?.backgroundColor || theme.colors.background.base;

const edges: Edge[] = [];
if (hasSafeArea || hasTopSafeArea) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/SectionList/SectionHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const DefaultSectionHeader = withTheme(
<Text
testID="default-section-header"
style={{
color: theme.colors.background.brand,
color: theme.colors.background.base,
backgroundColor: theme.colors.branding.primary,
fontSize: 16,
padding: 10,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/Surface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Surface: React.FC<React.PropsWithChildren<Props>> = ({
if (backgroundColor) {
return backgroundColor;
} else {
return colors.background.brand;
return colors.background.base;
}
};

Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/components/SwipeableItem/SwipeableItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,14 @@ const SwipeableItem: React.FC<React.PropsWithChildren<Props>> = ({
<Icon
name={item.icon}
size={item.iconSize || 25}
color={item.color || theme.colors.background.brand}
color={item.color || theme.colors.background.base}
/>
)}
{item.title && (
<Text
style={[
textStyles,
{ color: item.color || theme.colors.background.brand },
{ color: item.color || theme.colors.background.base },
]}
>
{item.title}
Expand Down Expand Up @@ -294,7 +294,7 @@ const SwipeableItem: React.FC<React.PropsWithChildren<Props>> = ({
style={[
styles.surfaceContainer,
{
backgroundColor: theme.colors.background.brand,
backgroundColor: theme.colors.background.base,
},
surfaceContainerStyles,
]}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/Swiper/Swiper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const Swiper = forwardRef<SwiperRef, SwiperProps<any>>(
prevTitleColor,
nextTitleColor,
dotsTouchable = true,
dotColor = theme?.colors.foreground.brand,
dotColor = theme?.colors.foreground.base,
dotActiveColor = theme?.colors.branding.primary,
data,
keyExtractor,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/TabView/TabView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const TabViewComponent: React.FC<React.PropsWithChildren<TabViewProps>> = ({
) : null
}
style={{
backgroundColor: tabsBackgroundColor || theme.colors.background.brand,
backgroundColor: tabsBackgroundColor || theme.colors.background.base,
}}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export interface Props<T> extends TableProps, ScrollViewProps {
const Table = <T extends object>({
theme,
borderWidth = 1,
borderColor = theme.colors.border.brand,
borderColor = theme.colors.border.base,
borderStyle = "solid",
drawTopBorder = true,
drawBottomBorder = false,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class TextField extends React.Component<Props, State> {
placeholderColor = colors.text.light;
borderColor = "transparent";
underlineColor = "transparent";
backgroundColor = colors.border.brand;
backgroundColor = colors.border.base;
} else {
activeColor = error ? colors.text.danger : activeBorderColorProp;
placeholderColor = borderColor = colors.text.light;
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/deprecated-components/AvatarEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const AvatarEdit: React.FC<React.PropsWithChildren<Props>> = ({
}) => {
const colorStyles = {
editBackgroundColor: theme.colors.branding.primary,
editIconColor: theme.colors.background.brand,
editBorderColor: theme.colors.background.brand,
editIconColor: theme.colors.background.base,
editBorderColor: theme.colors.background.base,
};

const dimensions = {
Expand Down
Loading

0 comments on commit 1dba828

Please sign in to comment.