CSS: how does colors work in dark mode vs light mode?

Hello,
I’m no expert in CSS, but I’ve tried to play with it a bit, and there is a basic thing I don’t understand.
This is my CSS snippet:

    .rem-reference--pdf-highlight {
	border-color: RGBA(253, 251, 197);
	border-width: 7px;
}

This is the result in light mode: a bright visible yellow
image

vs dark mode, it’s darker than the background…?
image

What puzzles me it that this behaviour seems to depend on the colour chosen, with red, everything is somewat ok:
image
image

I don’t understand what is happening… can anyone be kind enough to explain this (I think) basic stuff to me.

I have the same problem. Is so bad!

AFAIK the native dark mode still uses basic inversion for some stuff rather than assigning a different set of darker colours.

thanks, that’s not a full explaination, but convinced me to look not further into this
cheers