設計模式_設計

設計模式

Thanks for my colleague WanChing‘s help to prepare this sharing article. E-Commerce app collects plentiful products from various brands. Each brand has its brand signature colors and public image. This article introduces how we made a single page to present a different brand’s style depending on its trademark.

感謝我的同事WanChing協助編寫此共享文章。 電子商務應用程序收集來自各個品牌的豐富產品。 每個品牌都有其品牌標志色和公眾形象。 本文介紹了如何制作單個頁面來展示不同品牌的樣式(取決于其商標)。

E-Commerce app collects plentiful products from various brands. In the TW Yahoo shopping business, we have more than 200 brands. Each of them has a brand signature color, style, etc. For example, when it comes to l’occitane, the yellow color will be our first impression.

電子商務應用程序收集來自各個品牌的豐富產品。 在TW Yahoo購物業務中,我們有200多個品牌。 他們每個人都有品牌標志的顏色,樣式等。例如,當涉及歐舒丹時,黃色將是我們的第一印象。

Those signature colors are so important for a brand. If we use the same style and tone for all brands, the visual feeling will be inconsistent with the brand’s public image, and those brands cannot show their characteristics in our app. The same style is unacceptable for any brand since some brands treat this UI page as an official entry to buy their products online. The public image and spirit of the brand need to display to their customers accurately.

這些標志性色彩對于品牌來說非常重要。 如果我們對所有品牌使用相同的樣式和色調,則視覺感受將與品牌的公眾形象不一致,并且這些品牌無法在我們的應用程序中展現其特征。 任何品牌都無法接受相同的樣式,因為某些品牌將該用戶界面頁面視為在線購買其產品的正式條目。 品牌的公眾形象和精神需要準確地向客戶展示。

We introduce a method to implement a single page to present a different brand’s style depending on its trademark. Furthermore, we can make the editors set up which color a particular brand uses, or even unique colors during the promotions or holidays.

我們引入一種方法來實現一個頁面,以根據其商標呈現不同的品牌樣式。 此外,我們可以讓編輯者設置特定品牌使用的顏色,甚至在促銷或假日期間使用獨特的顏色。

設計 (Design)

When navigating to the brand page, the app will query the information (including name, banner image, trademark, promotions, etc.) of the brand from the server. Meanwhile, the app will also fetch the remote configuration of this brand, including predefined primary colors. If this brand has a remote configuration, it’s an individual case where we don’t want to use the trademark’s dominant color as the primary color.

導航到品牌頁面時,該應用程序將從服務器查詢品牌信息(包括名稱,橫幅圖像,商標,促銷等)。 同時,該應用程序還將獲取該品牌的遠程配置,包括預定義的原色。 如果該品牌具有遠程配置,那么在個別情況下,我們不想使用商標的主要顏色作為原色。

If there isn’t any remote configuration, the app needs to calculate the primary colors from the trademark. After deciding the primary color, we have sets of designs to fit with the primary color. Our designers pick those sets of colors to use on texts, buttons, links, etc.

如果沒有任何遠程配置,則應用程序需要根據商標計算原色。 在確定原色之后,我們有適合原色的設計方案。 我們的設計師選擇那些顏色用于文本,按鈕,鏈接等。

Apps calculate the primary colors from the trademark’s palette colors.
http://www.cssdrive.com/imagepalette/index.phphttp://www.cssdrive.com/imagepalette/index.php

When the primary color is dark, the app should choose the Dark Background Theme or Dark Text Theme, depending on the style setting. When the primary color is light, the app should only apply Light Background Theme.

當原色為深色時,應用程序應根據樣式設置選擇“ 深色背景主題”或“ 深色文本主題” 。 當原色為淺色時,應用程序應僅應用淺色背景主題

App chooses the different themes depending on the primary color.

深色背景主題 (Dark Background Theme)

In the Dark Background Theme, the app will use primary color as the background color of most components; currently, we predefine pure white color, 0xFFFFFF, as the text color. For extracting another color from the trademark, it is still under discussion.

在深色背景主題中,應用程序將使用原色作為大多數組件的背景色; 目前,我們將純白色0xFFFFFF預定義為文本顏色。 為了從商標中提取另一種顏色,仍在討論中。

Use primary color on loading indicator and promotion background.
Dark Background Theme
深色背景主題
Use primary color on tabbar and navigation buttons.
Dark Background Theme
深色背景主題
Use primary color on actionbar and toolbar’s background.
Dark Background Theme
深色背景主題

深色文字主題 (Dark Text Theme)

Dark Text Theme is almost the same as Dark Background Theme. The only difference is the promotion cell, whose background color is white, and the text is the primary color.

深色文本主題與深色背景主題幾乎相同。 唯一的區別是促銷單元格,其背景色為白色,文本為原色。

Use primary color on promotion’s text color.
Dark Text Theme
深色文字主題

淺色背景主題 (Light Background Theme)

In Light Background Theme, since the primary color is light, and the page applies it to the most background of the UI components, we need to make sure the text color has enough contrast. That’s why we choose a dark color as the text color in this case.

在淺色背景主題中,由于主要顏色是淺色,并且頁面將其應用于UI組件的大多數背景,因此我們需要確保文本顏色具有足夠的對比度。 這就是為什么在這種情況下我們選擇深色作為文本顏色的原因。

Use primary color on promotion background with text of dark color.
Light Background Theme
淺色背景主題
Use primary color on actionbar and buttons’ background with text of dark color.
Light Background Theme
淺色背景主題

Another thing that needs to be taking care of is: Since our page background color is #F3F3F3, when the primary color is also closed to white, the user will not be able to distinguish where the button is. To tackle this problem, we add a dark rim to the button whenever we realize the primary color is closed to a white color.

需要注意的另一件事是:由于我們的頁面背景顏色是#F3F3F3,因此當原色也被封閉為白色時,用戶將無法區分按鈕的位置。 為了解決這個問題,只要我們意識到原色接近白色,就會在按鈕上添加深色邊框。

Use primary color on the buttons’ border.
Light Background Theme with boarder
淺色背景主題與寄宿生

遠程配置設置 (Remote Configuration Setting)

A remote setting usually happens when there’s a big promotion event or holiday celebration. For example, some brands may want to use red or green as the primary color during Christmas. We have an online system for editors to set up the colors for the specific brand, and once we find the editor’s choice exists, we’ll use the color set directly. Currently, we didn’t open a lot of items to be configured. For now, the system merely supports changing the primary color. In our goal, we should dispose of all components’ background color, text color, border color, and even shadow color, so that our editors have full control over the UI.

當有大型促銷活動或節日慶祝活動時,通常會發生遠程設置。 例如,某些品牌可能希望在圣誕節期間使用紅色或綠色作為主要顏色。 我們有一個在線系統,供編輯人員設置特定品牌的顏色,一旦發現編輯的選擇存在,我們將直接使用顏色集。 當前,我們沒有打開很多要配置的項目。 目前,該系統僅支持更改原色。 在我們的目標中,我們應該處理所有組件的背景色,文本色,邊框色,甚至陰影色,以便我們的編輯者可以完全控制UI。

成就 (Achievement)

Now, this mechanism is already on our app for several months. It serves more than 200 brands and can fulfill most of the brand owners’ requirements no matter on normal days or special days. This mechanism may also be a possible solution to provide a more friendly UI for ads to bring our customer’s characteristics to their target users.

現在,這種機制已經在我們的應用程序上使用了幾個月。 它服務于200多個品牌,無論在正常工作日或特殊日子均可滿足大多數品牌所有者的要求。 此機制也可能是一種解決方案,可以為廣告提供更友好的UI,以將我們客戶的特征帶給其目標用戶。

  • Playboy

    花花公子
UI Snapshot of Playboy (the primary color is back)
  • Peanuts

    花生
UI Snapshot of Peanuts (the primary color is white)

擴展計劃 (Extension Plan)

After picking the primary color, we can calculate more relative colors from primary colors, such as the title text color, the body text color, which is already supported by the Android Palette library. Those colors are guaranteed to have sufficient contrast.

選擇原色后,我們可以根據原色計算更多的相對顏色,例如標題調色板顏色,正文文本顏色,Android Palette庫已經支持。 保證這些顏色具有足夠的對比度。

  • Text color on title is a color with a contrast ratio larger than 3.0f.

    標題上的文本顏色是一種對比度大于3.0f的顏色。

  • Text color on the body is a color with a contrast ratio larger than 4.5f.

    正文上的文本顏色是一種對比度大于4.5f的顏色。

We also try to migrate the formula from Android to other platforms and cooperate with our designers to calculate the identified text colors from the same primary color palette. Then we can support more styles than the current predefined themes.

我們還嘗試將公式從Android遷移到其他平臺,并與我們的設計師合作,從相同的主調色板計算已識別的文本顏色。 然后,我們可以支持比當前預定義主題更多的樣式。

實作 (Implementation)

商標原色選擇器 (Trademark Primary Color Picker)

Since each brand has its trademark and most of them use the brand signature color as the dominant color, we extract the dominant color of the bitmap of the trademark as the primary color of our UI page.

由于每個品牌都有其商標,并且大多數都使用品牌簽名顏色作為主色,因此我們提取商標位圖的主色作為UI頁面的原色。

  • Android

    安卓

Use AndroidX Palette library to get the colors from trademark:

使用AndroidX Palette庫從商標獲取顏色:

fun getPrimaryColor(trademark: Bitmap) =
Palette.from(bitmap).generate().getDarkMutedColor(DEFAULT_COLOR)
  • iOS

    的iOS

We need to calculate the color because there is not a ready-made method:

我們需要計算顏色,因為沒有現成的方法:

extension UIImage {  var primaryColor: UIColor? {    guard let inputImage = CIImage(image: self) else { return nil }    let extentVector = CIVector(x: inputImage.extent.origin.x,
y: inputImage.extent.origin.y,
z: inputImage.extent.size.width,
w: inputImage.extent.size.height)
guard let filter = CIFilter(
name: "CIAreaAverage",
parameters: [kCIInputImageKey: inputImage,
kCIInputExtentKey: extentVector])
else { return nil }
guard let outputImage = filter.outputImage else { return nil } var bitmap = [UInt8](repeating: 0, count: 4) let context = UIImage.contextForAverage
context.clearCaches()
context.render(
outputImage, toBitmap: &bitmap, rowBytes: 4,
bounds: CGRect(x: 0, y: 0, width: 1, height: 1),
format: .RGBA8, colorSpace: nil)
return UIColor(red: CGFloat(bitmap[0]) / 255.0,
green: CGFloat(bitmap[1]) / 255.0,
blue: CGFloat(bitmap[2]) / 255.0,
alpha: CGFloat(bitmap[3]) / 255.0)
}

暗光探測器 (Dark Light Detector)

We use a formula to calculate if the primary color is a darken color or not and decide which color set we use for displaying the UI page. The following is how we determine the color is light:

我們使用公式來計算原色是否為深色,并確定用于顯示UI頁面的顏色集。 以下是我們確定顏色為淺色的方法:

  • Brightness of Color = ((r * 299) + (g * 587) + (b * 114)) / 1000.0f

    色彩亮度=((r * 299)+(g * 587)+(b * 114))/ 1000.0f

  • A light color = (brightness >= 204)

    淺色=(亮度> = 204)

And we need to understand whether the primary color is closed to white, the following is how we find out those colors:

我們需要了解原色是否接近白色,以下是我們找出這些顏色的方法:

  • Color close-to-white is a color with a brightness value larger than 239.

    接近白色的顏色是一種亮度值大于239的顏色。

翻譯自: https://uxdesign.cc/color-your-ui-with-trademark-or-remote-configuration-from-the-customers-9f6b6990f003

設計模式

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/274739.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/274739.shtml
英文地址,請注明出處:http://en.pswp.cn/news/274739.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

動態切換css

方法一&#xff1a;給link一個id&#xff0c;直接獲取該DOM操作href <link rel"stylesheet" id"stylelink" type"text/css"/> <a href"#" οnclickjavascript:document.getElementById("stylelink").href "…

使用 GTD 優化自己的工作和生活

大家好&#xff0c;我是若川。持續組織了8個月源碼共讀活動&#xff0c;感興趣的可以點此加我微信 ruochuan12 參與&#xff0c;每周大家一起學習200行左右的源碼&#xff0c;共同進步。同時極力推薦訂閱我寫的《學習源碼整體架構系列》 包含20余篇源碼文章。歷史面試系列。另外…

模仿不再受寵若驚

If you haven’t heard of the Jio-Zoom plagiarism clash, you’re probably living under a rock (which may not be a bad idea given the state of the world right now). The turf war between Jio Meet and Zoom began when the Indian telecom giant ripped off the Chi…

一個計算機愛好者的不完整回憶(二十八)關于計算機書籍

我只在大學階段在圖書館看了很多計算機方面的書&#xff0c;無論已經老得都殘破了還是最新出版的。前兩天又看到論壇中有關于計算機書籍特別是國內人士編寫或翻譯的計算機書籍的評論的文章&#xff0c;譚浩強老先生又毫無懸念的被牽連了進來。也發表一下自己的一些觀點吧。   …

Vue2剝絲抽繭-響應式系統 系列

大家好&#xff0c;我是若川。持續組織了8個月源碼共讀活動&#xff0c;感興趣的可以點此加我微信 ruochuan12 參與&#xff0c;每周大家一起學習200行左右的源碼&#xff0c;共同進步。同時極力推薦訂閱我寫的《學習源碼整體架構系列》 包含20余篇源碼文章。歷史面試系列。另外…

word文本樣式代碼樣式_使用文本樣式表達創建真相來源

word文本樣式代碼樣式As of After Effects 17.0, you can use expressions to edit text styles in After Effects. Here’s why this would transform your workflow:從After Effects 17.0開始&#xff0c;您可以使用表達式在After Effects中編輯文本樣式。 這就是這將改變您的…

mvn備忘

創建web工程 mvn archetype:generate -DgroupIdcom.malangmedia -DartifactIdautoDeployToJetty -DarchetypeArtifactIdmaven-archetype-webapp -Dversion1.0 添加jetty插件 <project xmlns"http://maven.apache.org/POM/4.0.0" xmlns:xsi"http://www.w3.or…

前端框架源碼解讀之Vite

前端工具鏈十年盤點&#xff1a;https://mp.weixin.qq.com/s/FBxVpcdVobgJ9rGxRC2zfgWebpack、Rollup 、Esbuild、Vite ?webpack: 基于 JavaScript 開發的前端打包構建框架&#xff0c;通過依賴收集&#xff0c;模塊解析&#xff0c;生成 chunk&#xff0c;最終輸出生成的打包…

hp-ux_UX中的格式塔-或-為什么設計師如此討厭間距

hp-uxI’ve been lucky so far in my design career to have worked with engineers that seem genuinely interested in learning about design. Perhaps, as mentioned in the title, it’s more about them trying to figure out why it matters so much to us that there i…

很多人都不知道,其實博客園給我們博客開了二級域名

如題。一直都在郵件簽名里寫自己的博客地址為&#xff1a; http://www.cnblogs.com/datacool&#xff1b;直到有天突然發現使用&#xff1a;http://datacool.cnblogs.com也可以訪問。不知道的趕緊測試&#xff0c;后者明顯要酷很多啊。該不是我是最后一個知道的吧&#xff0c;知…

JavaScript 數組新增 4 個非破壞性方法!

大家好&#xff0c;我是若川。持續組織了8個月源碼共讀活動&#xff0c;感興趣的可以點此加我微信 ruochuan12 參與&#xff0c;每周大家一起學習200行左右的源碼&#xff0c;共同進步。同時極力推薦訂閱我寫的《學習源碼整體架構系列》 包含20余篇源碼文章。歷史面試系列。另外…

自行車改裝電動車怎么樣_電動車聽起來應該是什么樣?

自行車改裝電動車怎么樣The sound of an all-electric car accelerating doesn’t have to sound like a standard combustion engine, It could sound like anything.全電動汽車加速的聲音不必聽起來像是標準的內燃機&#xff0c;它可以聽起來像任何東西。 These were the wor…

C++中的三種繼承public,protected,private(轉)

三種訪問權限 public:可以被任意實體訪問 protected:只允許子類及本類的成員函數訪問 private:只允許本類的成員函數訪問 三種繼承方式 public 繼承 protect 繼承 private 繼承 組合結果 基類中 繼承方式 子類中 public &#xff06; public繼承 > public public &#xff0…

如何碎片化時間學前端,了解前沿趨勢

我很開心在前端行業認識了一批優秀且樂于分享的朋友&#xff0c;他們的技術分享與職業觀點讓我獲益良多&#xff0c;推薦給大家一起關注。程序員成長指北Node.js 前端工程化 低代碼考拉小姐姐&#xff0c;一個有趣且樂于分享的人&#xff01;目前就職于某知名外企&#xff0c;負…

谷歌pay破解_Google Pay缺少Google聞名的一件事-UX案例研究

谷歌pay破解Disclaimer: The views expressed in the blog post is purely based on personal experience. It was not influenced by any external factor.When Google launched Tez (now Google Pay) in India during 2017, their primary goal was to design a simple payme…

進階高級前端,這位大前端架構師一定不能錯過

今天給大家介紹一位好朋友&#xff1a;這波能反殺&#xff1a;一位擁有十年工作經驗&#xff0c;對學習方法有獨到理解的資深大前端架構師。一、博客早在 2017 年初&#xff0c;波神在簡書平臺以《前端基礎進階》為名&#xff0c;更新了一系列優質文章&#xff0c;獲得大量認可…

memcached應用策略(轉)

memcached應用策略&#xff08;轉&#xff09;(2012-04-05 11:10:02) 轉載▼標簽&#xff1a; memcached 應用策略 it分類&#xff1a; linux_c memcached應用策略memcached 主要的作用是為減輕大訪問量對數據庫的沖擊&#xff0c;所以一般的邏輯是首先從memcached中讀取數據&a…

突然討厭做前端,討厭代碼_為什么用戶討厭重新設計

突然討厭做前端,討厭代碼重點 (Top highlight)The core of design thinking is to only design something that will bring value and fill the gap in consumer needs. Right? Why else would one design something that no one asked for? While that may be true to some …

那些年我面過的「六年經驗」的初級工程師

大家好&#xff0c;我是若川。持續組織了8個月源碼共讀活動&#xff0c;感興趣的可以 點此加我微信ruochuan12 參與&#xff0c;每周大家一起學習200行左右的源碼&#xff0c;共同進步。同時極力推薦訂閱我寫的《學習源碼整體架構系列》 包含20余篇源碼文章。歷史面試系列。另外…

sql反模式分析2

第八章 多列屬性目標&#xff1a;存儲多值屬性 為一個bug設置多個標簽反模式&#xff1a;創建多個列&#xff0c;為bugs創建tag1&#xff0c;tag2&#xff0c;tag3幾個列保存標簽。標簽必須放于其中一個。1.查詢數據&#xff0c;比如搜索這三列&#xff0c;可以使用in語句2.添…