@@ -2,7 +2,8 @@ import { addIosImageSetContents, EImageSetType } from '../../../services/ios/ser
22import { generateResizedAssets } from '../../../services/image.processing' ;
33import { config } from './config' ;
44import { join } from 'path' ;
5- import { replaceInFile , copyFile } from '../../../services/file.processing' ;
5+ import { replaceInFile } from '../../../services/file.processing' ;
6+ import { getNormalizedRGBAColors } from '../../../services/color.processing' ;
67import { EResizeMode } from '../../../services/type' ;
78import { getIosPackageName } from '../../../utils' ;
89
@@ -14,17 +15,24 @@ export const addIosSplashScreen = async (
1415 try {
1516 const iosSplashImageFolder = addIosImageSetContents ( 'SplashImage' , EImageSetType . IMAGE ) ;
1617 await generateIosSplashImages ( imageSource , iosSplashImageFolder ) ;
17- copyStoryBoardToProject ( ) ;
18+ setBackgroundColorToStoryBoard ( backgroundColor ) ;
1819 setNewSplashScreenFileRefInInfoPlist ( ) ;
1920 } catch ( err ) {
2021 console . log ( err ) ;
2122 }
2223} ;
2324
24- const copyStoryBoardToProject = ( ) => {
25- copyFile (
25+ const setBackgroundColorToStoryBoard = ( backgroundColor : string ) => {
26+ const { red, green, blue, alpha } = getNormalizedRGBAColors ( backgroundColor ) ;
27+ replaceInFile (
2628 join ( __dirname , `../../../../templates/ios/SplashScreen.storyboard` ) ,
27- `./ios/${ config . iosStoryboardName } .storyboard`
29+ `./ios/${ config . iosStoryboardName } .storyboard` ,
30+ [
31+ {
32+ oldContent : / < c o l o r .* k e y = " b a c k g r o u n d C o l o r " .* \/ > / g,
33+ newContent : `<color key="backgroundColor" red="${ red } " green="${ green } " blue="${ blue } " alpha="${ alpha } " colorSpace="custom" customColorSpace="sRGB"/>` ,
34+ } ,
35+ ]
2836 ) ;
2937} ;
3038
@@ -40,7 +48,7 @@ const setNewSplashScreenFileRefInInfoPlist = () => {
4048} ;
4149
4250const generateIosSplashImages = ( imageSource : string , iosSplashImageFolder : string ) => {
43- const { multipliers, size, backgroundColor } = config . iosSplashImage ;
51+ const { multipliers, size } = config . iosSplashImage ;
4452 return Promise . all (
4553 multipliers . map ( multiplier =>
4654 generateResizedAssets (
0 commit comments