@@ -17,8 +17,8 @@ impl ColorTheme {
1717 }
1818 }
1919
20- pub fn add_color ( & mut self , name : String , value : String ) {
21- self . data . insert ( name, value) ;
20+ pub fn add_color ( & mut self , name : & str , value : & str ) {
21+ self . data . insert ( name. to_string ( ) , value. to_string ( ) ) ;
2222 }
2323
2424 pub fn get_color ( & self , name : & str ) -> Option < & String > {
@@ -54,8 +54,8 @@ impl Color {
5454 }
5555 }
5656
57- pub fn add_theme ( & mut self , name : String , theme : ColorTheme ) {
58- self . themes . insert ( name, theme) ;
57+ pub fn add_theme ( & mut self , name : & str , theme : ColorTheme ) {
58+ self . themes . insert ( name. to_string ( ) , theme) ;
5959 }
6060
6161 pub fn get_theme ( & self , name : & str ) -> Option < & ColorTheme > {
@@ -156,12 +156,12 @@ impl Theme {
156156 }
157157 }
158158
159- pub fn add_color_theme ( & mut self , name : String , theme : ColorTheme ) {
159+ pub fn add_color_theme ( & mut self , name : & str , theme : ColorTheme ) {
160160 self . colors . add_theme ( name, theme) ;
161161 }
162162
163- pub fn add_typography ( & mut self , name : String , typography : Vec < Typography > ) {
164- self . typography . insert ( name, typography) ;
163+ pub fn add_typography ( & mut self , name : & str , typography : Vec < Typography > ) {
164+ self . typography . insert ( name. to_string ( ) , typography) ;
165165 }
166166
167167 pub fn to_css ( & self ) -> String {
@@ -233,13 +233,13 @@ mod tests {
233233 fn to_css_from_theme ( ) {
234234 let mut theme = Theme :: new ( ) ;
235235 let mut color_theme = ColorTheme :: new ( ) ;
236- color_theme. add_color ( "primary" . to_string ( ) , "#000" . to_string ( ) ) ;
237- theme. add_color_theme ( "default" . to_string ( ) , color_theme) ;
236+ color_theme. add_color ( "primary" , "#000" ) ;
237+ theme. add_color_theme ( "default" , color_theme) ;
238238 let mut color_theme = ColorTheme :: new ( ) ;
239- color_theme. add_color ( "primary" . to_string ( ) , "#fff" . to_string ( ) ) ;
240- theme. add_color_theme ( "dark" . to_string ( ) , color_theme) ;
239+ color_theme. add_color ( "primary" , "#fff" ) ;
240+ theme. add_color_theme ( "dark" , color_theme) ;
241241 theme. add_typography (
242- "default" . to_string ( ) ,
242+ "default" ,
243243 vec ! [
244244 Typography :: new(
245245 Some ( "Arial" . to_string( ) ) ,
@@ -261,7 +261,7 @@ mod tests {
261261 ) ;
262262
263263 theme. add_typography (
264- "default1" . to_string ( ) ,
264+ "default1" ,
265265 vec ! [ Typography :: new(
266266 Some ( "Arial" . to_string( ) ) ,
267267 Some ( "24px" . to_string( ) ) ,
0 commit comments