mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 21:06:31 +03:00
Implement Consistent Color Generation (XEP-0392)
This should make colors used by Delta Chat for emails similar to colors used by XMPP clients implementing the same specification[1], such as Conversations and Snikket. Previously Delta Chat used only hardcoded 16 colors, so this change should also increase the number of colors and make it easier to distinguish different contacts. [1] https://xmpp.org/extensions/xep-0392.html
This commit is contained in:
@@ -9,15 +9,14 @@ use regex::Regex;
|
||||
|
||||
use crate::aheader::EncryptPreference;
|
||||
use crate::chat::ChatId;
|
||||
use crate::color::str_to_color;
|
||||
use crate::config::Config;
|
||||
use crate::constants::{
|
||||
Chattype, DC_CHAT_ID_DEADDROP, DC_CONTACT_ID_DEVICE, DC_CONTACT_ID_DEVICE_ADDR,
|
||||
DC_CONTACT_ID_LAST_SPECIAL, DC_CONTACT_ID_SELF, DC_GCL_ADD_SELF, DC_GCL_VERIFIED_ONLY,
|
||||
};
|
||||
use crate::context::Context;
|
||||
use crate::dc_tools::{
|
||||
dc_get_abs_path, dc_str_to_color, improve_single_line_input, listflags_has, EmailAddress,
|
||||
};
|
||||
use crate::dc_tools::{dc_get_abs_path, improve_single_line_input, listflags_has, EmailAddress};
|
||||
use crate::events::EventType;
|
||||
use crate::key::{DcKey, SignedPublicKey};
|
||||
use crate::login_param::LoginParam;
|
||||
@@ -947,7 +946,7 @@ impl Contact {
|
||||
/// and can be used for an fallback avatar with white initials
|
||||
/// as well as for headlines in bubbles of group chats.
|
||||
pub fn get_color(&self) -> u32 {
|
||||
dc_str_to_color(&self.addr)
|
||||
str_to_color(&self.addr)
|
||||
}
|
||||
|
||||
/// Gets the contact's status.
|
||||
|
||||
Reference in New Issue
Block a user