From 10cbc1eaa1ae7d68cb4686f2a8644fdc039b9169 Mon Sep 17 00:00:00 2001 From: Kim Asendorf Date: Fri, 18 Nov 2016 17:39:22 +0100 Subject: [PATCH] colorPicker hex output fixed the textfield output --- src/components/ofxDatGuiColorPicker.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/components/ofxDatGuiColorPicker.h b/src/components/ofxDatGuiColorPicker.h index 013dae0..4d6e2c7 100644 --- a/src/components/ofxDatGuiColorPicker.h +++ b/src/components/ofxDatGuiColorPicker.h @@ -215,11 +215,8 @@ class ofxDatGuiColorPicker : public ofxDatGuiTextInput { inline void setTextFieldInputColor() { // convert color value to a six character hex string // - std::stringstream ss; - ss<< std::hex << mColor.getHex(); - std::string res ( ss.str() ); - while(res.size() < 6) res+="0"; - mInput.setText(ofToUpper(res)); + string hex = ofToHex(mColor.getHex()).substr(2); + mInput.setText(ofToUpper(hex)); mInput.setBackgroundColor(mColor); mInput.setTextInactiveColor(mColor.getBrightness() < BRIGHTNESS_THRESHOLD ? ofColor::white : ofColor::black); }