How to change colour inside the circle as my mouse moves

Hey guys I am super new to open frameworks and wanted to know how to can I change colors as an object rotates.

Here is my code :
#include “ofApp.h”

//--------------------------------------------------------------
void ofApp::setup(){
c.set(255, 100, 0);

}

//--------------------------------------------------------------
void ofApp::update(){

rotate = ofMap(ofGetMouseX(), 0.0, ofGetWidth(), 0, 255);
rotate = ofMap(ofGetMouseY(), 0.0, ofGetHeight(), 0, 255);
int b = (int)ofRandom(0, 255);


//rotate++;

}

//--------------------------------------------------------------
void ofApp::draw(){
ofSetColor(255,0,0);

ofPushMatrix();
ofSetCircleResolution(250);
ofTranslate(ofGetWidth()/2, ofGetHeight()/2);

ofDrawCircle(0, 0, 150);

ofSetLineWidth(2.2);
ofSetColor(255,0,0);

ofSetColor(0);
ofDrawCircle(0, 0, 50);
ofSetLineWidth(2.2);
//ofNoFill();
ofDrawCircle(0, 0, 45);

ofRotateDeg(rotate);
ofSetColor(0);
ofDrawRectangle(0, 0, 53, 53);

ofPopMatrix();
//ofDrawCircle(0, 0, 45);

Hi @Kshitj_srivastava , I think you are very close! There are lots of ways to use values (like from the mouse) to change a color; here is one based on the code you posted:

// make a color instance in ofApp.h to use in the project
ofColor color

// set the hue and brightness from the mouse in ofApp.update()
    float hue = ofMap(ofGetMouseX(), 0.f, ofGetWidth(), 0.f, 255.f);
    float brightness = ofMap(ofGetMouseY(), 0.f, ofGetHeight(), 0.f, 255.f);
    color.setHsb(hue, 255.f, brightness);

Also have a look at the colorExample; its very well commented and a fun example to play around with too!

Hey, what’s that int b in update() for? It looks like you never use it anywhere.