If you'd like to use colors in your plugins for making messages stand out in the server console, you can use the below code snippet and change the color to your liking. Just try not to go overboard by adding a rainbow of text.
Available colors:Code:global.ServerConsole.PrintColoured(System.ConsoleColor.Yellow, "This is a yellow message, good for debug messages")
Source: https://msdn.microsoft.com/en-us/library/system.consolecolor(v=vs.110).aspx
- Black, Blue, Cyan, DarkBlue, DarkCyan, DarkGray, DarkGreen, DarkMagenta, DarkRed, DarkYellow, Gray, Green, Magenta, Red, White, Yellow
You could also use the old method, which limits you to white, yellow, and red, though the messages would go to the appropriate log file based on which one you use.
White (normal):
Yellow (debug):Code:UnityEngine.Debug.Log.methodarray[0]:Invoke(nil, util.TableToArray({ "Hello world!" }))
Red (error):Code:UnityEngine.Debug.LogWarning.methodarray[0]:Invoke(nil, util.TableToArray({ "Hello world!" }))
Code:UnityEngine.Debug.LogError.methodarray[0]:Invoke(nil, util.TableToArray({ "Hello world!" }))
Using colors in server console
Discussion in 'Rust Development' started by Wulf, Jan 31, 2015.
-
Wulf Community Admin
-
-
that's only for plugin devs
-
-
-
Does not work? Doesnt give out an error but also doesnt work...
Code:global.ServerConsole.PrintColoured(System.ConsoleColor.Green, "[Supply Signal]: Loaded!")
-
Wulf Community Admin
-
This is what I found.
-
Wulf Community Admin
-
-
-
-
Code:
void printyellow(string msg) { Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine( msg); }
-
Wulf Community Admin