void colorSchemeDesigner::assignRandom(bool unique) {
	
	colorSchemeIndices.clear();
	applyColorIndeces.clear();
	
    for (int i = 0; i < colorScheme[0].size(); i++) {
        colorSchemeIndices.push_back(ofVec2f(0,i));
    }
    
    if  (mode == 1 || mode == 3 || mode == 5) {
        for (int i = 0; i < colorScheme[0].size(); i++) {
            colorSchemeIndices.push_back(ofVec2f(1,i));
        }
    }
    
    if  (mode == 2 || mode == 3 || mode == 4 || mode == 5) {
        for (int i = 0; i < colorScheme[0].size(); i++) {
            colorSchemeIndices.push_back(ofVec2f(2,i));
        }
        for (int i = 0; i < colorScheme[0].size(); i++) {
            colorSchemeIndices.push_back(ofVec2f(3,i));
        }
    }
	
	for (int i=0; i<assignColors.size(); i++)
	{
		int index = ofRandom(0, colorSchemeIndices.size());
		applyColorIndeces.push_back(index);
	}
	
	assert( assignColors.size() == applyColorIndeces.size() );
	
	applyColors();
}
Пример #2
0
static void cb_OK(fltk::Button*, void*) {
  //windowColorSettings->hide();
  saveActiveScheme();
  applyColors();
  saveEfltkConfig();
  exit(0);
}
KstChooseColorDialogI::KstChooseColorDialogI(QWidget* parent,
              const char* name, bool modal, WFlags fl)
  : KstChooseColorDialog(parent, name, modal, fl) {
  xVector->setChecked(true);
  connect(OK, SIGNAL(clicked()), this, SLOT(applyColors()));  
  _xSelected = true;
  _grid = 0L;
  _override = false;
}
Пример #4
0
void FormStyle::newColor()
{
	if ( !ui.colorE->text().isEmpty() )
	{
		if ( chkName( ui.colorE->text() ) )
			return;
		allowChColor = false;
		ui.colorsB->addItem( ui.colorE->text() );
		ui.colorsB->setCurrentIndex( ui.colorsB->count() - 1 );
		allowChColor = true;
		ReadOnly = false;
		applyColors();
	}
}
void colorSchemeDesigner::updateColorScheme() {
    primary.setHsb(hue, saturation, brightness);
    
    ofFloatColor primaryHB, primaryHS, primaryLB, primaryLS;
    primaryHB = primaryHS = primaryLB = primaryLS = primary;
    
    primaryHB.setBrightness(primary.getBrightness() + distance);
    primaryLB.setBrightness(primary.getBrightness() - distance);
    primaryHS.setSaturation(primary.getSaturation() + distance);
    primaryLS.setSaturation(primary.getSaturation() - distance);
    
    colorScheme[0][0] = primary;
    colorScheme[0][1] = primaryHB;
    colorScheme[0][2] = primaryLB;
    colorScheme[0][3] = primaryHS;
    colorScheme[0][4] = primaryLS;
    
    
    if (mode == 1 || mode == 5) {
        
        ofFloatColor complement, complementHB, complementHS, complementLB, complementLS;
        complement = primary;
        float cHue = primary.getHue() - 0.5;
        if ( cHue < 0.0 ) cHue += 1.0;
        complement.setHue(cHue);
        complementHB = complementHS = complementLB = complementLS = complement;
        
        complementHB.setBrightness(complement.getBrightness() + distance);
        complementLB.setBrightness(complement.getBrightness() - distance);
        complementHS.setSaturation(complement.getSaturation() + distance);
        complementLS.setSaturation(complement.getSaturation() - distance);
        
        colorScheme[1][0] = complement;
        colorScheme[1][1] = complementHB;
        colorScheme[1][2] = complementLB;
        colorScheme[1][3] = complementHS;
        colorScheme[1][4] = complementLS;
        
    }
    
    if (mode == 2 || mode == 4 || mode == 5) {
        
        
        ofFloatColor second, secondHB, secondHS, secondLB, secondLS;
        ofFloatColor third, thirdHB, thirdHS, thirdLB, thirdLS;
        
        float mod = (mode == 2) ? 0.5 : 0.0;
        
        second = third = primary;
        float sHue = primary.getHue() - mod + angle;
        if ( sHue < 0.0 ) sHue += 1.0;
        second.setHue(sHue);
        
        float tHue = primary.getHue() - mod - angle;
        if ( tHue < 0.0 ) tHue += 1.0;
        third.setHue(tHue);
        
        secondHB = secondHS = secondLB = secondLS = second;
        
        secondHB.setBrightness(second.getBrightness() + distance);
        secondLB.setBrightness(second.getBrightness() - distance);
        secondHS.setSaturation(second.getSaturation() + distance);
        secondLS.setSaturation(second.getSaturation() - distance);
        
        colorScheme[2][0] = second;
        colorScheme[2][1] = secondHB;
        colorScheme[2][2] = secondLB;
        colorScheme[2][3] = secondHS;
        colorScheme[2][4] = secondLS;
        
        
        //thirds
        thirdHB = thirdHS = thirdLB = thirdLS = third;
        
        thirdHB.setBrightness(third.getBrightness() + distance);
        thirdLB.setBrightness(third.getBrightness() - distance);
        thirdHS.setSaturation(third.getSaturation() + distance);
        thirdLS.setSaturation(third.getSaturation() - distance);
        
        colorScheme[3][0] = third;
        colorScheme[3][1] = thirdHB;
        colorScheme[3][2] = thirdLB;
        colorScheme[3][3] = thirdHS;
        colorScheme[3][4] = thirdLS;
        
    }
    
    if (mode == 3) {
        ofFloatColor complement, complementHB, complementHS, complementLB, complementLS;
        complement = primary;
        float cHue = primary.getHue() - 0.5;
        if ( cHue < 0.0 ) cHue += 1.0;
        complement.setHue(cHue);
        complementHB = complementHS = complementLB = complementLS = complement;
        
        complementHB.setBrightness(complement.getBrightness() + distance);
        complementLB.setBrightness(complement.getBrightness() - distance);
        complementHS.setSaturation(complement.getSaturation() + distance);
        complementLS.setSaturation(complement.getSaturation() - distance);
        
        colorScheme[1][0] = complement;
        colorScheme[1][1] = complementHB;
        colorScheme[1][2] = complementLB;
        colorScheme[1][3] = complementHS;
        colorScheme[1][4] = complementLS;
        
        
        ofFloatColor second, secondHB, secondHS, secondLB, secondLS;
        ofFloatColor third, thirdHB, thirdHS, thirdLB, thirdLS;
        
        second = primary;
        float sHue = primary.getHue() + angle;
        if ( sHue > 1.0 ) sHue -= 1.0;
        second.setHue(sHue);
        
        third = complement;
        float tHue = complement.getHue() + angle;
        if ( tHue > 1.0 ) tHue -= 1.0;
        third.setHue(tHue);
        
        secondHB = secondHS = secondLB = secondLS = second;
        
        secondHB.setBrightness(second.getBrightness() + distance);
        secondLB.setBrightness(second.getBrightness() - distance);
        secondHS.setSaturation(second.getSaturation() + distance);
        secondLS.setSaturation(second.getSaturation() - distance);
        
        colorScheme[2][0] = second;
        colorScheme[2][1] = secondHB;
        colorScheme[2][2] = secondLB;
        colorScheme[2][3] = secondHS;
        colorScheme[2][4] = secondLS;
        
        
        //thirds
        thirdHB = thirdHS = thirdLB = thirdLS = third;
        
        thirdHB.setBrightness(third.getBrightness() + distance);
        thirdLB.setBrightness(third.getBrightness() - distance);
        thirdHS.setSaturation(third.getSaturation() + distance);
        thirdLS.setSaturation(third.getSaturation() - distance);
        
        colorScheme[3][0] = third;
        colorScheme[3][1] = thirdHB;
        colorScheme[3][2] = thirdLB;
        colorScheme[3][3] = thirdHS;
        colorScheme[3][4] = thirdLS;
    }
	applyColors();
}
Пример #6
0
static void cb_Apply(fltk::Button*, void*) {
  saveActiveScheme();
  applyColors();
  saveEfltkConfig();
}