Difference between pages "Limit mode" and "Is dark mode"

From Kolmafia
(Difference between pages)
Jump to navigation Jump to search
imported>Relyk
 
 
Line 1: Line 1:
{{
+
<onlyinclude>{{{{{format|Function2}}}
#vardefine:name|limit_mode}}{{
+
|name=is_dark_mode
#vardefine:return_type|string}}{{
+
|function1.return_type=boolean
 
+
|function1.description=Checks if the current KoLmafia theme is dark mode.
FunctionPage|
+
|description=Checks if the current KoLmafia theme is one of the "dark mode" themes. This function was added in r20566.
name={{#var:name}}|
+
|code1={{CodeSample
 
+
  |title=Code Samples
function1={{Function|
+
  |description=Use a different text color based on the user's theme.
name={{#var:name}}|
+
  |code=
aggregate={{#var:aggregate}}|
+
<syntaxhighlight lang="java">
return_type={{#var:return_type}}|
+
string WARN_COLOR = is_dark_mode() ? "#FFFF00" : "#A0522D";
return_also={{#var:return_also}}|
+
print("This is a warning.", WARN_COLOR);
}}|
 
 
 
function_description=Returns "spelunky" or an empty string.|
 
 
 
code1={{CodeSample|
 
title=Code Sample|
 
description=The following example|
 
code=<syntaxhighlight>
 
 
 
 
</syntaxhighlight>
 
</syntaxhighlight>
 
}}
 
}}
 
+
|special=
}}
+
|{{{1|}}}
 +
}}</onlyinclude>
 +
[[Category:Miscellaneous Functions]]

Revision as of 12:49, 20 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);