Change the default Pen tool color from black to another color?

EDC in Maine shared this question 6 years ago
Needs Answer

I am wondering if it's possible to change the default Pen tool color from black to another color, such as blue.


The Pen would write in the new color (blue) automatically, without needing to change the Pen tool color with the style bar.


I would like this to be true when an applet is loaded in a Web page on geogebra.org in HTML5, and to write in the other color (such as blue) without the style bar turned on for the applet. Any help is appreciated!


This is one of the files I would like this to work for: https://www.geogebra.org/m/FBT7YXDZ


Thanks!

Peter

Comments (3)

photo
1

An not that good idea:


write in javascript:


function ggbOnInit() {

ggbApplet.registerUpdateListener("WhenUpdate");

}


PenMode = 62;


function WhenUpdate(name)

{

var type = ggbApplet.getObjectType(name);

if(ggbApplet.getMode()==PenMode && ggbApplet.getColor(name)!="#0000FF")ggbApplet.evalCommand("SetColor["+name+",0,0,255]");

}

photo
1

add one more condition:


function ggbOnInit() {

ggbApplet.registerUpdateListener("WhenUpdate");

}


function WhenUpdate(name)

{

var type = ggbApplet.getObjectType(name);

if(ggbApplet.getMode()==62 && ggbApplet.getColor(name)!="#0000FF" && type == "penstroke")ggbApplet.evalCommand("SetColor["+name+",0,0,255]");

}

photo
1

not in web

Thanks, fixed for next release.

© 2023 International GeoGebra Institute