Feature - Implemented Add is_dark_mode()

philmasterplus

Active member
This patch adds a new ASH function: is_dark_mode(). It uses KoLmafiaGUI.isDarkTheme() to determine whether KoLmafia is using one of the FlatLaf dark themes. It also works in JavaScript as isDarkMode()

This function will enable script authors to use different text colors in the gCLI for light and dark modes. Script authors can utilize it to present the best color for the user's theme.

This patch was inspired by this discussion.
 

Attachments

  • philmasterplus-is-dark-mode.patch
    1.4 KB · Views: 2

MCroft

Developer
Staff member
r20566
tests:
Rich (BB code):
> ash print(is_dark_mode())
true
Returned: void

> ash print(is_dark_mode())
false
Returned: void

> js isDarkMode()
Returned: false

> js isDarkMode()
Returned: true

> ashref dark
boolean is_dark_mode( )

> jsref Dark
    Not a bug in is_dark_mode.  jsref might be better off being either case insensitive or else allow the case it actually uses...
> jsRef dark
boolean isDarkMode()

> ashq print(is_dark_mode())
true

Please add is_dark_mode() to the wiki somewhere.
 
Top