diff --git a/.travis.yml b/.travis.yml
index f7a64e2..7a88d81 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,7 +13,6 @@ node_js:
- '4'
before_install:
- - npm install -g npm
- npm --version
after_success:
diff --git a/README.md b/README.md
index 1c57551..03c93bd 100644
--- a/README.md
+++ b/README.md
@@ -92,6 +92,18 @@ console.log(this.toggleSwitch.checked);
'lg' |
|
+
+ onColor |
+ string / hex |
+ '#ff0000' |
+ Color when state is ON |
+
+
+ offColor |
+ string / hex |
+ '#009000' |
+ Color when state is OFF |
+
diff --git a/examples/index.jsx b/examples/index.jsx
index 7960367..98d8f64 100644
--- a/examples/index.jsx
+++ b/examples/index.jsx
@@ -102,6 +102,59 @@ class App extends React.Component {
+
+
+
+
+
+
+
+
+
+ ON Green
+
+
+
+ ON Green (Disabled)
+
+
+
+
+
+ OFF Red
+
+
+
+ ON / OFF (Red / Green)
+
+
+
+
+
+
+
);
}
diff --git a/package.json b/package.json
index 21ad89e..b92c760 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@trendmicro/react-toggle-switch",
- "version": "0.5.7",
+ "version": "0.5.8",
"description": "Trend Micro Components: React Toggle Switch",
"main": "lib/index.js",
"files": [
diff --git a/src/ToggleSwitch.jsx b/src/ToggleSwitch.jsx
index 1222483..5e9d842 100644
--- a/src/ToggleSwitch.jsx
+++ b/src/ToggleSwitch.jsx
@@ -55,12 +55,16 @@ class ToggleSwitch extends PureComponent {
className,
disabled,
size,
+ onColor,
+ offColor,
...props
} = this.props;
delete props.checked;
delete props.onChange;
+ const color = this.state.checked ? onColor : offColor;
+
return (
);