Closed
Description
Environment
- nativescript: 8.0.2
- @nativescript/core: 8.0.8
- @nativescript/android: 8.0.0
- @nativescript/ios: 8.0.0
Describe the bug
Could not set label and button colors for Dialogs
via css
(to handle dark mode colors)
To Reproduce
- run:
ns create ...
- add somewhere a
Dialog.alert('Hi')
- replace the scss as followed:
Page {
Label,
Button {
color: gray;
}
&.ns-dark {
Label,
Button {
color: white;
}
}
&.ns-light {
Label,
Button {
color: black;
}
}
}
Label,
Button {
color: blue;
&.ns-dark {
color: yellow;
}
&.ns-light {
color: green;
}
}
Expected behavior
- in light mode, the
Dialogs
text and button colors should beblack
orgreen
in light mode andwhite
oryellow
in dark mode - without dark/light mode support they shloud be
gray
orblue
;
Sample project
Playground is useless, because it it's last version runs on NS 6.5 (released a year ago).
Additional context
- the
lbl
andbtn
have nopage
orparentNode
, so the css selectorsPage Label
andPage Button
fail (described here: Dialogs: Provide ability to set different color/font style for title #3830 (comment)) - the
lbl
andbtn
have nons-light
orns-dark
css-class, so there is no possibility to set different colors via css. - on android and ios the color property of
lbl
andbtn
is:
color: {
_argb: 4278190335
_name: "blue"
a: 255
android: -16776961
argb: 4278190335
b: 255
g: 0
hex: "#0000FF"
ios: undefined
name: "blue"
r: 0
}
there are a some existing issues about this problem, wich are opend over moths, like:
#8484
NativeScript/theme#184
Summarized:
- no chance to apply custom colors for dark mode on both platforms (this is realy bad -> dialogs are not usable in dark mode)
- on android in dark mode gets generated "magically" a custom color (but at least is a bit lighter and could be used in dark mode)
- If I'm not wrong, this issue could not be solved, by css (and
@nativescript/theme
)