- // Get the current theme status.
- val currentThemeStatus = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
-
- // Set the blue color span according to the theme. The deprecated `getColor()` must be used until API >= 23.
- val blueColorSpan = if (currentThemeStatus == Configuration.UI_MODE_NIGHT_NO) {
- @Suppress("DEPRECATION")
- ForegroundColorSpan(resources.getColor(R.color.blue_700))
- } else {
- @Suppress("DEPRECATION")
- ForegroundColorSpan(resources.getColor(R.color.violet_700))
- }
+ // Set the blue color span.
+ val blueColorSpan = ForegroundColorSpan(requireContext().getColor(R.color.blue_text))