mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-09 10:19:41 +02:00
Add support for XEP-0392: Consistent Color Generation
Fixes SMACK-800.
This commit is contained in:
parent
8e3d3a7d14
commit
e0af3db189
5 changed files with 432 additions and 0 deletions
37
documentation/extensions/consistent_colors.md
Normal file
37
documentation/extensions/consistent_colors.md
Normal file
|
@ -0,0 +1,37 @@
|
|||
Consistent Colors
|
||||
=================
|
||||
|
||||
[Back](index.md)
|
||||
|
||||
Since XMPP can be used on multiple platforms at the same time,
|
||||
it might be a good idea to render given Strings like nicknames in the same
|
||||
color on all platforms to provide a consistent user experience.
|
||||
|
||||
The utility class `ConsistentColor` allows the generation of colors to a given
|
||||
string following the specification of [XEP-0392](https://xmpp.org/extensions/xep-0392.html).
|
||||
|
||||
##Usage
|
||||
To generate a consistent color for a given string, call
|
||||
```
|
||||
float[] rgb = ConsistentColor.RGBFrom(input);
|
||||
```
|
||||
The resulting float array contains values for RGB in the range of 0 to 1.
|
||||
|
||||
##Color Deficiency Corrections
|
||||
Some users might suffer from color vision deficiencies. To compensate those deficiencies,
|
||||
the API allows for color correction. The color correction mode is a static value, which can be changed at any time.
|
||||
|
||||
To correct colors for users with red-green color deficiency use the following code:
|
||||
```
|
||||
ConsistentColor.activateRedGreenBlindnessCorrection();
|
||||
```
|
||||
|
||||
For color correction for users with blue-blindness, call
|
||||
```
|
||||
ConsistentColor.activateBlueBlindnessCorrection();
|
||||
```
|
||||
|
||||
To deactivate color vision deficiency correction, call
|
||||
```
|
||||
ConsistenColor.deactivateDeficiencyCorrection();
|
||||
```
|
|
@ -95,6 +95,7 @@ Experimental Smack Extensions and currently supported XEPs of smack-experimental
|
|||
| HTTP File Upload | [XEP-0363](http://xmpp.org/extensions/xep-0363.html) | Protocol to request permissions to upload a file to an HTTP server and get a shareable URL. |
|
||||
| [Multi-User Chat Light](muclight.md) | [XEP-xxxx](http://mongooseim.readthedocs.io/en/latest/open-extensions/xeps/xep-muc-light.html) | Multi-User Chats for mobile XMPP applications and specific enviroment. |
|
||||
| [OMEMO Multi End Message and Object Encryption](omemo.md) | [XEP-XXXX](https://conversations.im/omemo/xep-omemo.html) | Encrypt messages using OMEMO encryption (currently only with smack-omemo-signal -> GPLv3). |
|
||||
| [Consistent Color Generation](consistent_colors.md) | [XEP-0392](http://xmpp.org/extensions/xep-0392.html) | Generate consistent colors for identifiers like usernames to provide a consistent user experience. |
|
||||
| Google GCM JSON payload | n/a | Semantically the same as XEP-0335: JSON Containers |
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue