export const COLORS = {
primary: '#13678A', white: "#FFFFFF",
}
export default {
light: {
text: '#000',
background: '#fff',
tabIconDefault: '#ccc',
},
dark: {
text: '#fff',
background: '#000',
tabIconDefault: '#ccc',
}
};
위와 같은 경우, 다른 파일에서 불러 올때는 다음과 같이 부릅니다.
import customTheme, { COLORS } from './Constant.js';
// customTheme 사용 예시
console.log(customTheme.light); // { text: '#000', background: '#fff', tabIconDefault: '#ccc' }
console.log(customTheme.dark); // { text: '#fff', background: '#000', tabIconDefault: '#ccc' }
// COLORS 사용 예시
console.log(COLORS.primary); // '#13678A'
console.log(COLORS.white); // '#FFFFFF'
즉 default 의 경우는 별도의 이름을 붙이고, customTheme, 객체의 경우는 destructing 후 객체명을 이용하여 부릅니다.
firebase hosting + vite.js (0) | 2024.04.17 |
---|---|
Vite.js 에서 환경변수 사용 .env (1) | 2024.04.17 |
JavaScript 소숫점 다루기 (0) | 2024.03.26 |
includes(), has(), size(), length() in JavaScript (0) | 2023.11.29 |
CommonJS module 와 ES module (2) | 2023.11.01 |