Skip to content

Commit 9379276

Browse files
authored
Impl clone for colors (#79)
* add Clone/Copy derives * update changelog
1 parent 2f7405f commit 9379276

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [0.8.0] - 2022-xx-xx
88
### Added
99
- impl `Clone`, `Serialize` and `PartialEq` for `Plot`
10+
- impl `Clone` +/- `Copy` for color types
1011
- Support for [configuration options](https://plotly.com/javascript/configuration-options/)
1112
- Support for layout templates and pre-defined themes
1213
- Support for WASM environments

plotly/src/common/color.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub trait Color {
2525
fn to_color(&self) -> ColorWrapper;
2626
}
2727

28-
#[derive(Debug)]
28+
#[derive(Debug, Clone, Copy)]
2929
pub struct Rgb {
3030
r: u8,
3131
g: u8,
@@ -44,7 +44,7 @@ impl Color for Rgb {
4444
}
4545
}
4646

47-
#[derive(Debug)]
47+
#[derive(Debug, Clone, Copy)]
4848
pub struct Rgba {
4949
r: u8,
5050
g: u8,
@@ -68,7 +68,7 @@ impl Color for Rgba {
6868
}
6969

7070
// https://www.w3.org/TR/css-color-3/#svg-color
71-
#[derive(Debug)]
71+
#[derive(Debug, Clone, Copy)]
7272
pub enum NamedColor {
7373
AliceBlue,
7474
AntiqueWhite,

0 commit comments

Comments
 (0)