summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-01-24 22:03:30 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-01-24 22:03:30 -0800
commitb92449c73e3b80a85144de08e0062c74cb37e80d (patch)
tree441cbfe78e5d228d47e84fb764f13be0d7a970a7
parent70c44a0da2bdeead90a99fe79e7c047d38b8ca5c (diff)
downloadgitlab-ce-b92449c73e3b80a85144de08e0062c74cb37e80d.tar.gz
Predefine colors for project identicons
-rw-r--r--app/assets/stylesheets/generic/avatar.scss4
-rw-r--r--app/assets/stylesheets/sections/dashboard.scss2
-rw-r--r--app/helpers/application_helper.rb17
-rw-r--r--app/views/dashboard/_project.html.haml4
-rw-r--r--app/views/groups/_projects.html.haml4
5 files changed, 20 insertions, 11 deletions
diff --git a/app/assets/stylesheets/generic/avatar.scss b/app/assets/stylesheets/generic/avatar.scss
index f04848ae6dc..b6886206739 100644
--- a/app/assets/stylesheets/generic/avatar.scss
+++ b/app/assets/stylesheets/generic/avatar.scss
@@ -29,10 +29,10 @@
vertical-align: top;
&.s16 { font-size: 12px; line-height: 1.33; }
- &.s24 { font-size: 18px; line-height: 1.33; }
+ &.s24 { font-size: 14px; line-height: 1.8; }
&.s26 { font-size: 20px; line-height: 1.33; }
&.s32 { font-size: 24px; line-height: 1.33; }
&.s60 { font-size: 45px; line-height: 1.33; }
&.s90 { font-size: 68px; line-height: 1.33; }
&.s160 { font-size: 120px; line-height: 1.33; }
-} \ No newline at end of file
+}
diff --git a/app/assets/stylesheets/sections/dashboard.scss b/app/assets/stylesheets/sections/dashboard.scss
index 3135056db58..00795f990bf 100644
--- a/app/assets/stylesheets/sections/dashboard.scss
+++ b/app/assets/stylesheets/sections/dashboard.scss
@@ -100,7 +100,7 @@
}
.dash-project-access-icon {
float: left;
- margin-right: 3px;
+ margin-right: 5px;
width: 16px;
}
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 32fd0ed7bcc..f253ae91306 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -64,13 +64,22 @@ module ApplicationHelper
end
def project_identicon(project, options = {})
+ allowed_colors = {
+ red: 'FFEBEE',
+ purple: 'F3E5F5',
+ indigo: 'E8EAF6',
+ blue: 'E3F2FD',
+ teal: 'E0F2F1',
+ orange: 'FBE9E7',
+ gray: 'EEEEEE'
+ }
+
options[:class] ||= ''
options[:class] << ' identicon'
- bg_color = Digest::MD5.hexdigest(project.name)[0, 6]
- brightness = bg_color[0, 2].hex + bg_color[2, 2].hex + bg_color[4, 2].hex
- text_color = (brightness > 375) ? '#000' : '#fff'
+ bg_key = project.id % 7
+
content_tag(:div, class: options[:class],
- style: "background-color: ##{ bg_color }; color: #{ text_color }") do
+ style: "background-color: ##{ allowed_colors.values[bg_key] }; color: #555") do
project.name[0, 1].upcase
end
end
diff --git a/app/views/dashboard/_project.html.haml b/app/views/dashboard/_project.html.haml
index 7f19fb5a81c..76b95264fd8 100644
--- a/app/views/dashboard/_project.html.haml
+++ b/app/views/dashboard/_project.html.haml
@@ -1,8 +1,8 @@
= link_to project_path(project), class: dom_class(project) do
- .dash-project-avatar
- = project_icon(project.to_param, alt: '', class: 'avatar s24')
.dash-project-access-icon
= visibility_level_icon(project.visibility_level)
+ .dash-project-avatar
+ = project_icon(project.to_param, alt: '', class: 'avatar s24')
%span.str-truncated
%span.namespace-name
- if project.namespace
diff --git a/app/views/groups/_projects.html.haml b/app/views/groups/_projects.html.haml
index 2716ebf326b..34221595fd7 100644
--- a/app/views/groups/_projects.html.haml
+++ b/app/views/groups/_projects.html.haml
@@ -12,10 +12,10 @@
- projects.each do |project|
%li.project-row
= link_to project_path(project), class: dom_class(project) do
- .dash-project-avatar
- = project_icon(project.to_param, alt: '', class: 'avatar s24')
.dash-project-access-icon
= visibility_level_icon(project.visibility_level)
+ .dash-project-avatar
+ = project_icon(project.to_param, alt: '', class: 'avatar s24')
%span.str-truncated
%span.project-name
= project.name