Telegram Android only defines whether a theme is dark or not based on the name of that theme.
If a theme is named "Dark Blue" or "Night", it will be considered as dark. Otherwise it will be considered as light. This cause issues with the Dark/Light theme switcher in the Drawer which uses the last dark theme for the dark theme.
Your new custom theme (which is based on a dark theme) is now considered as light. This means the Light/Dark switch will switch from your theme to the previous night theme.
Dark theme should be considered dark based on the
windowBackgroundWhite field AND/OR on a boolean attribute.
The boolean attribute is just a feature suggestion, but it should at least be based on
windowBackgroundWhite. Assuming the hex value of
#242424, converting this color to HSL could allow us to obtain the lightness of this color, which in this case is 14%. So, by converting any color to HSL and obtaining its lightness, we can know whether the color is dark (
L < 50) or light (
L >= 50).
As mentionned above, the boolean attribute is just a feature suggestion. It could allow users to force set a theme to dark or light even if the
windowBackgroundWhiteindicates the opposite. It could be done with the built-in theme editor, so if users change
windowBackgroundWhite, the boolean is set accordingly. However, if the user manually updates the boolean, changing
windowBackgroundWhitedoesn't update the boolean anymore.