refactor: enable profile image color
This commit is contained in:
parent
5128541db9
commit
7d4b7b0049
4 changed files with 21 additions and 65 deletions
|
|
@ -47,11 +47,11 @@ frappe.ui.form.set_user_image = function(frm) {
|
|||
.find('.sidebar-standard-image')
|
||||
.removeClass('hide')
|
||||
.find('.standard-image')
|
||||
.css({'background-color': frappe.get_palette(title)})
|
||||
.css({'background-color': '#fafbfc'})
|
||||
.html(frappe.get_abbr(title));
|
||||
|
||||
title_image.css("background-image", '')
|
||||
.css({'background-color': frappe.get_palette(title)})
|
||||
.css({'background-color': '#fafbfc'})
|
||||
.html(frappe.get_abbr(title));
|
||||
|
||||
image_actions.find('.sidebar-image-change').show();
|
||||
|
|
|
|||
|
|
@ -39,8 +39,10 @@ frappe.avatar = function (user, css_class, title, image_url = null) {
|
|||
abbr = abbr.substr(0, 1);
|
||||
}
|
||||
return `<span class="avatar ${css_class}" title="${title}">
|
||||
<div class="avatar-frame standard-image" style="background-color: ${user_info.color};">
|
||||
${abbr}</div>
|
||||
<div class="avatar-frame standard-image"
|
||||
style="background-color: var(${user_info.color[0]}); color: var(${user_info.color[1]})">
|
||||
${abbr}
|
||||
</div>
|
||||
</span>`;
|
||||
}
|
||||
};
|
||||
|
|
@ -72,14 +74,21 @@ frappe.ui.scroll = function(element, animate, additional_offset) {
|
|||
}
|
||||
};
|
||||
|
||||
frappe.palette = [
|
||||
['--orange-100', '--orange-600'],
|
||||
['--pink-50', '--pink-500'],
|
||||
['--blue-50', '--blue-500'],
|
||||
['--green-50', '--green-500'],
|
||||
['--dark-green-50', '--dark-green-500'],
|
||||
['--red-50', '--red-500'],
|
||||
['--yellow-50', '--yellow-500'],
|
||||
['--purple-50', '--purple-500'],
|
||||
['--gray-50', '--gray-500']
|
||||
]
|
||||
|
||||
frappe.get_palette = function(txt) {
|
||||
return '#fafbfc';
|
||||
// //return '#8D99A6';
|
||||
// if(txt==='Administrator') return '#36414C';
|
||||
// // get color palette selection from md5 hash
|
||||
// var idx = cint((parseInt(md5(txt).substr(4,2), 16) + 1) / 5.33);
|
||||
// if(idx > 47) idx = 47;
|
||||
// return frappe.palette[idx][0]
|
||||
var idx = cint((parseInt(md5(txt).substr(4,2), 16) + 1) / 5.33);
|
||||
return frappe.palette[idx%8];
|
||||
}
|
||||
|
||||
frappe.get_abbr = function(txt, max_length) {
|
||||
|
|
@ -189,57 +198,6 @@ frappe.get_cookies = function getCookies() {
|
|||
return cookies;
|
||||
}
|
||||
|
||||
frappe.palette = [
|
||||
['#FFC4C4', 0],
|
||||
['#FFE8CD', 0],
|
||||
['#FFD2C2', 0],
|
||||
['#FF8989', 0],
|
||||
['#FFD19C', 0],
|
||||
['#FFA685', 0],
|
||||
['#FF4D4D', 1],
|
||||
['#FFB868', 0],
|
||||
['#FF7846', 1],
|
||||
['#A83333', 1],
|
||||
['#A87945', 1],
|
||||
['#A84F2E', 1],
|
||||
['#D2D2FF', 0],
|
||||
['#F8D4F8', 0],
|
||||
['#DAC7FF', 0],
|
||||
['#A3A3FF', 0],
|
||||
['#F3AAF0', 0],
|
||||
['#B592FF', 0],
|
||||
['#7575FF', 0],
|
||||
['#EC7DEA', 0],
|
||||
['#8E58FF', 1],
|
||||
['#4D4DA8', 1],
|
||||
['#934F92', 1],
|
||||
['#5E3AA8', 1],
|
||||
['#EBF8CC', 0],
|
||||
['#FFD7D7', 0],
|
||||
['#D2F8ED', 0],
|
||||
['#D9F399', 0],
|
||||
['#FFB1B1', 0],
|
||||
['#A4F3DD', 0],
|
||||
['#C5EC63', 0],
|
||||
['#FF8989', 1],
|
||||
['#77ECCA', 0],
|
||||
['#7B933D', 1],
|
||||
['#A85B5B', 1],
|
||||
['#49937E', 1],
|
||||
['#FFFACD', 0],
|
||||
['#D2F1FF', 0],
|
||||
['#CEF6D1', 0],
|
||||
['#FFF69C', 0],
|
||||
['#A6E4FF', 0],
|
||||
['#9DECA2', 0],
|
||||
['#FFF168', 0],
|
||||
['#78D6FF', 0],
|
||||
['#6BE273', 0],
|
||||
['#A89F45', 1],
|
||||
['#4F8EA8', 1],
|
||||
['#428B46', 1]
|
||||
]
|
||||
|
||||
frappe.is_mobile = function() {
|
||||
return $(document).width() < 768;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
|
||||
|
||||
frappe.user_info = function(uid) {
|
||||
if(!uid)
|
||||
uid = frappe.session.user;
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@
|
|||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background-color: var(--blue-50) !important;
|
||||
background-color: var(--blue-50);
|
||||
color: var(--blue-500);
|
||||
font-weight: normal;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue