summaryrefslogtreecommitdiff
path: root/doc/en/weechat_plugin_api.en.adoc
diff options
context:
space:
mode:
Diffstat (limited to 'doc/en/weechat_plugin_api.en.adoc')
-rw-r--r--doc/en/weechat_plugin_api.en.adoc49
1 files changed, 49 insertions, 0 deletions
diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc
index c7fb69c34..172e9a936 100644
--- a/doc/en/weechat_plugin_api.en.adoc
+++ b/doc/en/weechat_plugin_api.en.adoc
@@ -1888,6 +1888,55 @@ str = weechat.string_format_size(size)
str = weechat.string_format_size(15200) # == "15.2 KB"
----
+==== string_color_code_size
+
+_WeeChat ≥ 3.0._
+
+Return the size (in bytes) of the WeeChat color code at the beginning of
+the string.
+
+Prototype:
+
+[source,C]
+----
+int weechat_string_color_code_size (const char *string);
+----
+
+Arguments:
+
+* _string_: string
+
+Return value:
+
+* size (in bytes) of the WeeChat color code at the beginning of the string;
+ if the string is NULL, empty or does not start with a color code, 0 is returned;
+ if the string begins with multiple color codes, only the size of the first one
+ is returned
+
+C examples:
+
+[source,C]
+----
+int size;
+
+size = weechat_string_color_code_size ("test"); /* size == 0 */
+size = weechat_string_color_code_size (weechat_color ("bold")); /* size == 2 */
+size = weechat_string_color_code_size (weechat_color ("yellow,red")); /* size == 7 */
+----
+
+Script (Python):
+
+[source,python]
+----
+# prototype
+size = weechat.string_color_code_size(string)
+
+# examples
+size = weechat.string_color_code_size("test") # size == 0
+size = weechat.string_color_code_size(weechat.color("bold")) # size == 2
+size = weechat.string_color_code_size(weechat.color("yellow,red")) # size == 7
+----
+
==== string_remove_color
Remove WeeChat colors from a string.