Difference between revisions of "Is dark mode"

From Kolmafia
Jump to navigation Jump to search
(Created page with "<onlyinclude>{{{{{format|Function2}}} |name= |function1.return_type=boolean |function1.description=Checks if the current KoLmafia theme is dark mode. |description=Checks if th...")
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
<onlyinclude>{{{{{format|Function2}}}
 
<onlyinclude>{{{{{format|Function2}}}
|name=
+
|name=is_dark_mode
 
|function1.return_type=boolean
 
|function1.return_type=boolean
 
|function1.description=Checks if the current KoLmafia theme is dark mode.
 
|function1.description=Checks if the current KoLmafia theme is dark mode.
|description=Checks if the current KoLmafia theme is one of the "dark mode" themes. This function was added in r20566.
+
|description=Checks if the current KoLmafia theme is one of the "dark mode" themes. This function was added in [https://kolmafia.us/threads/20566-new-command-is_dark_mode-for-ash-philmasterplus.25740/ r20566].
 
|code1={{CodeSample
 
|code1={{CodeSample
 
   |title=Code Samples
 
   |title=Code Samples
 
   |description=Use a different text color based on the user's theme.
 
   |description=Use a different text color based on the user's theme.
 
   |code=
 
   |code=
<syntaxhighlight lang="java">
+
<syntaxhighlight lang="d">
 
string WARN_COLOR = is_dark_mode() ? "#FFFF00" : "#A0522D";
 
string WARN_COLOR = is_dark_mode() ? "#FFFF00" : "#A0522D";
 
print("This is a warning.", WARN_COLOR);
 
print("This is a warning.", WARN_COLOR);
Line 16: Line 16:
 
|{{{1|}}}
 
|{{{1|}}}
 
}}</onlyinclude>
 
}}</onlyinclude>
[[Category:Miscellaneous]]
+
[[Category:Miscellaneous Functions]]

Latest revision as of 05:13, 21 December 2020

Function Syntax

boolean is_dark_mode()

Checks if the current KoLmafia theme is dark mode.

Checks if the current KoLmafia theme is one of the "dark mode" themes. This function was added in r20566.

Code Samples

Use a different text color based on the user's theme.

string WARN_COLOR = is_dark_mode() ? "#FFFF00" : "#A0522D";
print("This is a warning.", WARN_COLOR);