Skip to content

🎥 Make videos programmatically with React

handle weird css better

Jonny Burger03acdbfbc24c
diff --git a/packages/bundler/src/setup-environment.ts b/packages/bundler/src/setup-environment.ts
index 420ad9ffe5..37810be323 100644
--- a/packages/bundler/src/setup-environment.ts
+++ b/packages/bundler/src/setup-environment.ts
@@ -3,10 +3,11 @@ import {Internals} from 'remotion';
Internals.setupEnvVariables();
Internals.CSSUtils.injectCSS(`
- .css-reset * {
+ .css-reset, .css-reset * {
font-size: 16px;
line-height: 1;
color: white;
font-family: Arial, Helvetica, sans-serif;
+ background-color: #1f2428;
}
`);
diff --git a/packages/cli/src/editor/components/Canvas.tsx b/packages/cli/src/editor/components/Canvas.tsx
index d413d3540d..cb029b5a5b 100644
--- a/packages/cli/src/editor/components/Canvas.tsx
+++ b/packages/cli/src/editor/components/Canvas.tsx
@@ -1,5 +1,6 @@
import {PlayerInternals} from '@remotion/player';
import React, {useRef} from 'react';
+import {BACKGROUND} from '../helpers/colors';
import {VideoPreview} from './Preview';
const container: React.CSSProperties = {
@@ -7,6 +8,7 @@ const container: React.CSSProperties = {
display: 'flex',
overflow: 'hidden',
position: 'relative',
+ backgroundColor: BACKGROUND,
};
export const Canvas: React.FC = () => {
diff --git a/packages/cli/src/editor/components/CompositionSelectorItem.tsx b/packages/cli/src/editor/components/CompositionSelectorItem.tsx
index 746b4fc4e2..b66c45ecad 100644
--- a/packages/cli/src/editor/components/CompositionSelectorItem.tsx
+++ b/packages/cli/src/editor/components/CompositionSelectorItem.tsx
@@ -1,7 +1,12 @@
import type {MouseEventHandler} from 'react';
import React, {useCallback, useMemo, useState} from 'react';
import type {TComposition} from 'remotion';
-import {CLEAR_HOVER, LIGHT_TEXT, SELECTED_BACKGROUND} from '../helpers/colors';
+import {
+ BACKGROUND,
+ CLEAR_HOVER,
+ LIGHT_TEXT,
+ SELECTED_BACKGROUND,
+} from '../helpers/colors';
import {isCompositionStill} from '../helpers/is-composition-still';
import {FilmIcon} from '../icons/film';
import {CollapsedFolderIcon, ExpandedFolderIcon} from '../icons/folder';
@@ -22,6 +27,7 @@ const itemStyle: React.CSSProperties = {
border: 'none',
width: '100%',
textAlign: 'left',
+ backgroundColor: BACKGROUND,
};
const iconStyle: React.CSSProperties = {
diff --git a/packages/cli/src/editor/components/CurrentComposition.tsx b/packages/cli/src/editor/components/CurrentComposition.tsx
index 0c333d7a55..0f781a36c3 100644
--- a/packages/cli/src/editor/components/CurrentComposition.tsx
+++ b/packages/cli/src/editor/components/CurrentComposition.tsx
@@ -1,5 +1,6 @@
import React, {useContext, useEffect} from 'react';
import {Internals} from 'remotion';
+import {BACKGROUND} from '../helpers/colors';
import {isCompositionStill} from '../helpers/is-composition-still';
import {renderFrame} from '../state/render-frame';
import {RichTimelineContext} from '../state/rich-timeline';
@@ -12,6 +13,7 @@ const container: React.CSSProperties = {
borderBottom: '1px solid black',
padding: 16,
color: 'white',
+ backgroundColor: BACKGROUND,
};
const title: React.CSSProperties = {
@@ -19,6 +21,7 @@ const title: React.CSSProperties = {
fontSize: 12,
whiteSpace: 'nowrap',
lineHeight: '18px',
+ backgroundColor: BACKGROUND,
};
const subtitle: React.CSSProperties = {
@@ -26,12 +29,14 @@ const subtitle: React.CSSProperties = {
opacity: 0.8,
whiteSpace: 'nowrap',
lineHeight: '18px',
+ backgroundColor: BACKGROUND,
};
const row: React.CSSProperties = {
display: 'flex',
flexDirection: 'row',
lineHeight: '18px',
+ backgroundColor: BACKGROUND,
};
const targetHeight = 60;
diff --git a/packages/example/src/Video.tsx b/packages/example/src/Video.tsx
index dc98132389..f3d6e789e0 100644
--- a/packages/example/src/Video.tsx
+++ b/packages/example/src/Video.tsx
@@ -33,7 +33,7 @@ if (alias !== 'alias') {
}
// Use it to test that UI does not regress on weird CSS
-// import './weird-css.css';
+import './weird-css.css';
export const Index: React.FC = () => {
const inputProps = getInputProps();
diff --git a/packages/example/src/weird-css.css b/packages/example/src/weird-css.css
index 0b3aea8bff..98fab776e3 100644
--- a/packages/example/src/weird-css.css
+++ b/packages/example/src/weird-css.css
@@ -9,4 +9,5 @@ html,
line-height: 5;
font-family: 'Comic Sans MS';
box-sizing: content-box;
+ background: green;
}