When I change the opacity of my Button, it turns my white text too gray.
Here’s what I get:
Here’s what I expect:
My coworker said it’s because there’s a box shadow somewhere, but I wasn’t able to pinpoint where it was coming from.
Here’s my Button. I’ve added a shape underneath it because I’m using the opacity to get a lighter shade, but I don’t really want it to be see through.
$(go.Panel, "Spot",
$("Shape", {
figure: "Pill",
width: 264,
height: 32,
fill: colorText,
stroke: colorText,
strokeWidth: 1,
parameter1: 100
}),
$("Button",
new go.Binding("isEnabled", "_isReadOnly", function(isReadOnly) {
return !isReadOnly;
}).ofModel(),
new go.Binding("opacity", "_isReadOnly", function(isReadOnly) {
return isReadOnly ? 0.25 : 1;
}).ofModel(), {
// set properties on the border Shape of the "Button"
"ButtonBorder.figure": "Pill",
"ButtonBorder.fill": primary1,
"ButtonBorder.stroke": primary1,
"ButtonBorder.strokeWidth": 1,
"ButtonBorder.width": 264,
"ButtonBorder.height": 32,
// parameter1 is similar (but not exact) to the border radius
"ButtonBorder.parameter1": 100,
// set properties on the "Button" itself used by its event handlers
"_buttonFillOver": primary2,
"_buttonStrokeOver": primary2,
"_buttonFillPressed": primary3,
"_buttonStrokePressed": primary3,
"_buttonFillDisabled": primary1,
"_buttonFillNormal": primary1,
click: function(event, buttonObject) {
// click handler
}
},
$(go.Panel, "Horizontal",
$(go.Picture, {
source: "images/circle-plus-md-white.svg",
height: 16,
width: 16,
margin: new go.Margin(0, 8, 0, 0)
}),
$(go.TextBlock,
new go.Binding("text", "labelText"), {
stroke: nowColorText,
font: "16px 'Open Sans', sans-serif",
verticalAlignment: go.Spot.Center,
margin: new go.Margin(2, 0, 0, 0)
})
)
)
)
);