@@ -57,10 +57,10 @@ pub enum ColorType<T = String>
5757 ) ,
5858 /// Vector of tuples of `u8` (as per `RGBColor`), but instead of a single color for the whole
5959 /// plot, the vector should contain a separte color for each data point.
60- VariableRGBIntegers ( Vec < RGBInts > ) ,
60+ VariableRGBInteger ( Vec < RGBInts > ) ,
6161 /// Vector of tuples of `u8` (as per `ARGBColor`), but as with `VariableRGBColor`, a separate
6262 /// color value is given for each data point.
63- VariableARGBIntegers ( Vec < ARGBInts > ) ,
63+ VariableARGBInteger ( Vec < ARGBInts > ) ,
6464 /// TODO
6565 PaletteFracColor ( f32 ) ,
6666 /// TODO
@@ -98,8 +98,8 @@ impl<T: Display> ColorType<T>
9898 RGBString ( s) => format ! ( r#"rgb "{}""# , s) ,
9999 RGBInteger ( r, g, b) => format ! ( r#"rgb {}"# , from_argb( 0 , * r, * g, * b) ) ,
100100 ARGBInteger ( a, r, g, b) => format ! ( r#"rgb {}"# , from_argb( * a, * r, * g, * b) ) ,
101- VariableRGBIntegers ( _) => String :: from ( "rgb variable" ) ,
102- VariableARGBIntegers ( _) => String :: from ( "rgb variable" ) ,
101+ VariableRGBInteger ( _) => String :: from ( "rgb variable" ) ,
102+ VariableARGBInteger ( _) => String :: from ( "rgb variable" ) ,
103103 PaletteFracColor ( _) => todo ! ( ) ,
104104 PaletteCBColor ( _) => todo ! ( ) ,
105105 VariablePaletteColor ( _) => String :: from ( "palette z" ) ,
@@ -118,11 +118,11 @@ impl<T: Display> ColorType<T>
118118 RGBString ( _) => panic ! ( "data() called on non-variable color type." ) ,
119119 RGBInteger ( _, _, _) => panic ! ( "data() called on non-variable color type." ) ,
120120 ARGBInteger ( _, _, _, _) => panic ! ( "data() called on non-variable color type." ) ,
121- VariableRGBIntegers ( items) => items
121+ VariableRGBInteger ( items) => items
122122 . iter ( )
123123 . map ( |( r, g, b) | from_argb ( 0 , * r, * g, * b) as f64 )
124124 . collect ( ) ,
125- VariableARGBIntegers ( items) => items
125+ VariableARGBInteger ( items) => items
126126 . into_iter ( )
127127 . map ( |( a, r, g, b) | from_argb ( * a, * r, * g, * b) as f64 )
128128 . collect ( ) ,
@@ -141,8 +141,8 @@ impl<T: Display> ColorType<T>
141141 {
142142 match self
143143 {
144- VariableRGBIntegers ( _)
145- | VariableARGBIntegers ( _)
144+ VariableRGBInteger ( _)
145+ | VariableARGBInteger ( _)
146146 | VariableIndex ( _)
147147 | VariablePaletteColor ( _)
148148 | SavedColorMap ( _, _) => true ,
@@ -170,7 +170,7 @@ impl<T: Display> ColorType<T>
170170 false
171171 }
172172 }
173- ARGBInteger ( _, _, _, _) | VariableARGBIntegers ( _) => true ,
173+ ARGBInteger ( _, _, _, _) | VariableARGBInteger ( _) => true ,
174174 _ => false ,
175175 }
176176 }
@@ -275,15 +275,23 @@ impl<T> Into<ColorType<T>> for Vec<RGBInts>
275275{
276276 fn into ( self ) -> ColorType < T >
277277 {
278- ColorType :: VariableRGBIntegers ( self )
278+ ColorType :: VariableRGBInteger ( self )
279279 }
280280}
281281
282282impl < T > Into < ColorType < T > > for Vec < ARGBInts >
283283{
284284 fn into ( self ) -> ColorType < T >
285285 {
286- ColorType :: VariableARGBIntegers ( self )
286+ ColorType :: VariableARGBInteger ( self )
287+ }
288+ }
289+
290+ impl < T > Into < ColorType < T > > for ColorIndex
291+ {
292+ fn into ( self ) -> ColorType < T >
293+ {
294+ ColorType :: Index ( self )
287295 }
288296}
289297
@@ -305,7 +313,7 @@ impl<T: Display> OneWayOwned for ColorType<T>
305313 {
306314 RGBString ( s) => RGBString ( s. to_string ( ) ) ,
307315 RGBInteger ( r, g, b) => RGBInteger ( * r, * g, * b) ,
308- VariableRGBIntegers ( d) => VariableRGBIntegers ( d. clone ( ) ) ,
316+ VariableRGBInteger ( d) => VariableRGBInteger ( d. clone ( ) ) ,
309317 PaletteFracColor ( _) => todo ! ( ) ,
310318 PaletteCBColor ( _) => todo ! ( ) ,
311319 VariablePaletteColor ( d) => VariablePaletteColor ( d. clone ( ) ) ,
@@ -315,7 +323,7 @@ impl<T: Display> OneWayOwned for ColorType<T>
315323 Index ( n) => Index ( * n) ,
316324 Black => Black ,
317325 ARGBInteger ( a, r, g, b) => ARGBInteger ( * a, * r, * g, * b) ,
318- VariableARGBIntegers ( d) => VariableARGBIntegers ( d. clone ( ) ) ,
326+ VariableARGBInteger ( d) => VariableARGBInteger ( d. clone ( ) ) ,
319327 }
320328 }
321329}
@@ -328,14 +336,14 @@ impl ColorType<String>
328336 {
329337 RGBString ( s) => RGBString ( s) ,
330338 RGBInteger ( r, g, b) => RGBInteger ( * r, * g, * b) ,
331- VariableRGBIntegers ( d) => VariableRGBIntegers ( d. to_vec ( ) ) ,
332- VariableARGBIntegers ( d) => VariableARGBIntegers ( d. to_vec ( ) ) ,
339+ VariableRGBInteger ( d) => VariableRGBInteger ( d. to_vec ( ) ) ,
340+ VariableARGBInteger ( d) => VariableARGBInteger ( d. to_vec ( ) ) ,
333341 PaletteFracColor ( _) => todo ! ( ) ,
334342 PaletteCBColor ( _) => todo ! ( ) ,
335343 VariablePaletteColor ( d) => VariablePaletteColor ( d. to_vec ( ) ) ,
336344 SavedColorMap ( s, d) => SavedColorMap ( s, d. to_vec ( ) ) ,
337345 VariableIndex ( d) => VariableIndex ( d. to_vec ( ) ) ,
338- Background => todo ! ( ) ,
346+ Background => Background ,
339347 Index ( n) => Index ( * n) ,
340348 Black => Black ,
341349 ARGBInteger ( a, r, g, b) => ARGBInteger ( * a, * r, * g, * b) ,
0 commit comments