Материальный дизайн
Содержание:
- Выбор цвета элемента
- Что такое Material Design
- How to change cell color in Google Sheets
- Text Fields
- Shape
- Widget styles and attributes
- Alternate column OR row color with conditional formatting in Google Sheets
- Анимация в Material Design
- How to count colored cells
- Активные цвета
- Color
- How to alternate row color in Google Sheets
- Buttons
- How to sum values by color
- Material Design Websites
- Немного истории
- How to remove color from cells in Google Sheets
- Palette colors
- Typography
- Customization¶
- Cards
- How to change text color in Google Sheets
- Update the results
- Bottom Navigation
- Build a Material Theme
- More resources
Выбор цвета элемента
Чтобы изменить фоновый цвет страницы, используйте поле Заливка на панели Свойства, когда элементы не выбраны.
Можно изменять цвет контура и заливки элементов с помощью инструментов для работы с цветом. Чтобы настраивать цвета, используйте панели «Цвет» и «Свойства» или инструменты «Контур» и «Заливка» на панели инструментов.
С помощью панели «Цвет»
- Нажмите на элемент, для которого нужно выбрать цвет.
- Нажмите на образец цвета возле параметра Заливка или Граница в верхней части панели «Цвет».
- Выберите цвет на цветовой панели или в палитре образцов цветов.
С помощью панели «Свойства»
- Нажмите на элемент, для которого нужно выбрать цвет.
- В разделе Стиль панели Свойства нажмите на образец в поле Цвет заливки или Цвет границы. Откроется цветовая панель.
- Выберите цвет на цветовой панели, в палитре образцов цветов или в рабочей области с помощью инструмента «Пипетка».
С помощью инструмента «Заливка»
- Выберите инструмент Заливка на панели инструментов или нажмите клавишу F. Если на панели инструментов есть инструмент «Контур» или «Градиент» , нажмите и удерживайте его, чтобы выбрать инструмент «Заливка» во всплывающем меню.
- Выберите цвет, нажав на значок с образцом или используя панель «Цвет».
- Наведите указатель мыши на элемент, для которого нужно выбрать цвет. Вокруг него появится зеленый контур.
- Нажмите на элемент.
С помощью инструмента «Контур»
- Нажмите и удерживайте инструмент Заливка на панели инструментов, затем во всплывающем меню выберите инструмент Контур . Если на панели инструментов отображается инструмент «Градиент», нажмите и удерживайте его кнопку, чтобы выбрать инструмент «Контур» во всплывающем меню. Также можно нажать клавишу K.
- Настройте контур:
- Чтобы выбрать цвет контура или границы, нажмите на значок с образцом на панели инструментов.
- Укажите толщину границы (для большинства элементов) или контура (для объектов типа «Линия» и «Овал») на панели настроек инструмента.
- Выберите стиль границ в раскрывающемся меню Стиль на панели настроек инструмента.
- Наведите указатель мыши на элемент, границы которого нужно изменить. Вокруг него появится зеленый контур.
- Нажмите на элемент.
Что такое Material Design
К 2014 году проблему удалось решить. Именно тогда на конференции I/O Google представили свою новую дизайн-систему Material Design. Компания не просто представила гайдлайн по визуальному стилю, но и заявила о себе как о единой цифровой среде.
Что касается визуального стиля, Material Design примирил скевоморфизм с флэтом. Он не вернулся к реализму, но добавил в плоский дизайн его опыт взаимодействия с реальным миром — за счет знакомых тактильных характеристик и глубины.
Скевоморфизм — стиль в веб-дизайне, максимально подражающий объектам реального мира.
Флэт — упрощенный, минималистичный стиль с акцентом на функциональность, а не визуал.
Material Design базируется на тактильной реальности, вдохновлен изучением бумаги и чернил, технологически продвинут и открытдля воображения и магии.
В основе Material Design лежат четыре принципа:
1. Тактильные поверхности
Все элементы интерфейса — это слои цифровой бумаги. Они располагаются на разной высоте и отбрасывают тени. Это помогает пользователям отличить главные элементы от второстепенных и делает интерфейс интуитивно понятным.
2. Полиграфический дизайн
Логично, что на цифровой бумаге нужно писать цифровыми чернилами. Все, что изображено и написано на слоях-элементах, подчиняется законам печатного дизайна
Так можно акцентировать внимание пользователя на нужном элементе и обозначить иерархию интерфейса
3. Осознанная анимация
Все элементы, которые есть на экране, не могут просто так появляться и исчезать, — ведь в реальной жизни так не бывает. Объекты плавно переходят один в другой и подсказывают пользователю, как работает интерфейс.
4. Адаптивный дизайн
Все вышеперечисленное должно работать на любых устройствах.
Четыре основных принципа Material Design наглядно. Источник
Как видите, анимация — одна из основ Material Design. И хотя некоторые ее критикуют, поклонников все же больше. И вот почему.
How to change cell color in Google Sheets
First, let’s change the color of a single cell. When referring to changing the color of a cell itself, we are talking about changing the background color of that cell.
To color a cell in Google Sheets, select the cell that you want to color, open the «fill color» menu, then select the color that you want.
Notice that in this example, in cell C6, the assignment grade is 32.71%. Let’s say that we want to manually mark this cell red, to make it stand out.
To do this simply click/select cell C6, then open the «Fill Color» menu, then select the color red.
(See the top of this article for visual instructions on selecting color from the palette)
Text Fields
Material Text Fields include two main variants. As a result of porting the pre-existing AppCompat and classes, there are in fact two base styles: and . The variants have a style suffix and include filled box (default, ) and outlined box (). All text field variants use the standard text appearance for input and the theme attribute for “helper” text (labels, errors, counters, etc.).
The key attributes for customizing the styles are as follows:
- : The mode of the box background, which can be either , or .
- : The color of the text field background. The default enabled color is for filled box text fields and transparent for outlined box text fields.
- : The color of the stroke around the text field background. The default color is (in default state) for outlined box text fields and is ignored for filled box text fields.
- //: Various colors for different “helper” text sub-components.
- : The shape appearance of the text field background. The default value is .
The base text field style (used by the widget class) can be customized and applied globally like so:
<style name="AppTheme" parent="Theme.MaterialComponents.Light"> ... <item name="textInputStyle">@style/AppTextField</item></style><style name="AppTextField" parent="Widget.MaterialComponents.TextInputLayout.FilledBox"><item name="boxBackgroundColor">@color/text_field_background</item></style>
Note: is a that uses and the same alpha values as the default .
The result can be observed in our playground screen:
Customized Text Field widget styles
Shape
Shape attributes refer to the general form of each surface and widget in your app. When you consider that these components can be of varying width/height and be raised/unelevated/outlined, this reduces down to one aspect of customization… Corners.
Material Components corners can either be part of the rounded (default) or cut and have a to customize the size. A treatment can be applied to all corners or a subset. The shape theme attributes reference styles:
- : For small components, such as Buttons and Chips
- : For medium components, such as Cards
- : For large components, such as Bottom Sheets
The Material Components widgets will use these styles as per the Material guidelines.
If you wish to customize the Material Components shape appearance styles, you would do so like this:
<style name="AppTheme" parent="Theme.MaterialComponents.Light"> ... <item name="shapeAppearanceSmallComponent">@style/AppShapeAppearance.SmallComponent</item> <item name="shapeAppearanceMediumComponent">@style/AppShapeAppearance.MediumComponent</item></style><style name="AppShapeAppearance.SmallComponent" parent="ShapeAppearance.MaterialComponents.SmallComponent"> <item name="cornerFamily">cut</item> <item name="cornerSize">8dp</item></style><style name="AppShapeAppearance.MediumComponent" parent="ShapeAppearance.MaterialComponents.MediumComponent"> <item name="cornerFamily">cut</item> <item name="cornerSize">8dp</item></style>
The result can be observed in our playground screen:
Playground screen with global shape attributes customized
Widget styles and attributes
While global theming covers the majority of our needs, there are times when we may wish to customize the attributes of individual widgets. We will explore the styles (and relevant attributes) of common widgets and how these can be referenced in your Material Components theme.
Alternate column OR row color with conditional formatting in Google Sheets
Another way to use alternating colors is the use conditional formatting. With this method you will be able to alternate row colors, or if needed you will also be able to alternate column colors.
To apply alternating colors with conditional formatting, use any of the 4 formulas below, in the «Format cells if…» options, under the «Custom formula is» drop-down selection:
- =ISEVEN(ROW())
- =ISODD(ROW())
- =ISEVEN(COLUMN())
- =ISODD(COLUMN())
Conditional formatting is an amazingly useful tool that allows you to format cells based on their contents, and the following is just one of the many ways that you can use conditional formatting in Google Sheets.
Like in the last example, here you can either select the range to color first, or you can type it into the «Apply to range» field in the conditional formatting menu.
To open the conditional formatting menu do either of the following:
- Click the «Format» menu, and the click «Conditional formatting…» or…
- Open the «Fill color» menu, and click «Conditional formatting…»
Then select «Custom formula is» from the drop-down menu under the «Format cells if…» options.
Then use one of the formulas described below, depending on your preference/situation.
The formula below will color even rows:
=ISEVEN(ROW())
The formula below will color odd rows:
=ISODD(ROW())
The formula below will color even columns (B, D, F, etc…):
=ISEVEN(COLUMN())
The formula below will color odd columns (A, C, E, etc…):
=ISODD(COLUMN())
If you want you can choose your own color from the formatting style options, and you can select other formatting options to apply to the cells/rows/columns that your conditional formatting rules apply to.
The example below uses the formula =ISEVEN(ROW()) to color even rows. The range that the rule / color is applied to is A1:K1000
This example uses the formula =ISEVEN(COLUMN()) to color even columns. The range that the rule / color is applied to is A1:K1000
To remove this type of alternating color that is applied with conditional formatting, you can do either of the following:
- Open the conditional formatting menu and click «Remove rule» (Trash can symbol) to remove the conditional formatting or…
- Select a range, then click «Format, then click «Clear formatting». But note that this method will remove ALL formatting
Анимация в Material Design
В отличие от Apple, у которых анимация несет преимущественно эстетическую функцию, Google делает ставку на UX и функциональность. В их рекомендациях анимации уделено гораздо больше внимания, а на конференциях то и дело им посвящаются доклады.
Основная идея анимации в Material Design — сделать пользовательский интерфейс выразительным и простым в использовании. Для этого она должна отвечать трем принципам.
Информативность
Анимация показывает пространственные и иерархические связи между элементами: какие действия доступны пользователю и что произойдет, если он выполнит одно из них.
Анимация фокусирует внимание на том, что важно, и не отвлекает от основного действия
Анимация выражает характер, индивидуальность и стиль каждого продукта.
Таким образом, с помощью анимации можно:
Показать пользователю, как элементы связаны друг с другом.
Показать, как выполнять разные действия.
3. Сделать вау-эффект
Добавить привлекательности, чтобы пользователь снова захотел взаимодействовать с продуктом.
И это только верхушка айсберга. Google действительно заставил мир пересмотреть отношение к анимации и сделал ее полноценной частью UX-дизайна. Можно искать недостатки в рекомендациях Material Design, но, думаем, не стоит совсем игнорировать значение анимации сегодня.
А вот забавное замечание об одном из положений Material Design — о том, что все предметы, выходящие из экрана, должны ускоряться
Ведущий разработчик Джон Шлеммер считает, что неважно, где именно они остановятся
«В руководстве по материальному дизайну Google, похоже, думают, что вы должны только ускоряться при выходе из экрана», — Паскаль Д’Сильва. Источник
Благодаря Material Design анимация сегодня — не просто эффектное дополнение дизайна, а полноценная его часть. Если вы все делаете правильно, движение оживляет ваш интерфейс и заставляет пользователей любить интерфейс. Научиться создавать крутые анимации можно на курсе «Анимация интерфейсов».
Курс «Анимация интерфейсов»
Вы сможете самостоятельно создавать любую анимацию в интерфейсах и эффективно доносить концепцию проектов до клиентов. Мы начнем с анимации простейших элементов, таких как иконки, и дойдем до создания полноценных кейсов и шоурилов.
- Живая обратная связь с преподавателями
- Неограниченный доступ к материалам курса
- Стажировка в компаниях-партнёрах
- Дипломный проект от реального заказчика
- Гарантия трудоустройства в компании-партнёры для выпускников, защитивших дипломные работы
How to count colored cells
Let’s take one of the most common tasks with colored cells in a spreadsheet: counting cells that have the same formatting. Say, here I have a list of grades and I want to see how many times each test was passed, i.e. count all green cells in a column:
If you work with similar ranges that comprise different types of records: numbers, text, or date values, embrace the COUNTA function with the Function by color tool.
For a start, open the tool to sum by color. In Power Tools, you will see it right on the smart toolbar:
Here are six simple settings you need to specify to get the results:
- The range with the color-coded data that you want to check: I pick the columns with the test results.
- The pattern cell. The function will take its font and/or background color and look for the same in other cells. I pick the fill color of B2 as an example.
- The function. When you want to count cells with particular formatting, it’s best to choose the COUNTA function because it is the only one that works with non-numeric values. This way we can be sure that the format of the data in the cells will not impede with the results.
- The place for results. I want to count in each column so it is three cells for me.
- How to apply it. We can choose to count cells in each row, column, or in all selected cells. As I want to count green cells for each test, I choose to Calculate in each column. If I wanted a general result for all three tests, I’d choose the «entire range».
- The formatting of cells with the result. You can have them filled with the same colors as you count by selecting just one checkbox.
Once I click Insert function, the tool adds the formula under each column, so I will see the results for each test:
Let me break down its syntax and explain each part:
- =COUNTA is one of standard Google Sheets functions you pick to use with the colored cells.
- ligh green 3 is the cell color considered for the calculations, i.e. the background color of the pattern cell.
- «» is empty since I don’t consider the font color of the pattern cell.
- B2:B18 is the range to check for colored cells. It looks at cells in column B in my example.
Активные цвета
Активные цвета контура и заливки представлены значками в нижней части панели инструментов слева. Цвет контура (цвет границы) обозначен незакрашенным значком.
На примере ниже выбраны цвета по умолчанию: белая заливка и черный контур.
Активные цвета применяются при использовании следующих инструментов:
- «Элемент»;
- «Перо» и инструменты добавления фигур;
- «Заливка» и «Контур».
Если выбран один элемент, активные цвета будут использоваться для его заливки и контура.
Активные цвета можно легко изменить с помощью кнопок над значками с образцами цветов:
- Стандартные цвета – позволяет вернуться к настройкам по умолчанию (белая заливка и черный контур).
- Поменять заливку и контур – меняет местами цвета заливки и контура (также можно нажать клавишу X).
Color
Color attributes consist mainly of primary, secondary, error, surface and background colors, along with their respective secondary variants and “on” colors. Some of these have been reused from the AppCompat themes (eg. , and ):
- : The primary brand color of your app, used most predominantly in theming
- : A lighter/darker variant of your primary brand color, used sparingly in theming
- : The color used for elements displayed on top of your primary colors (eg. Text and icons, often white or semi-transparent black depending on accessibility)
- : The secondary brand color of your app, used mostly as an accent for certain widgets that need to stand out
- : A lighter/darker variant of your secondary brand color, used sparingly in theming
- : The color used for elements displayed on top of your secondary colors
- : The color used for errors (often a shade of red)
- : The color used for elements displayed on top of your error color
- : The color used for surfaces (i.e. Material “sheets”)
- : The color used for elements displayed on top of your surface color
- : The color behind all other screen content
- : The color used for elements displayed on top of your background color
These colors can be added to your app theme like so:
<style name="AppTheme" parent="Theme.MaterialComponents.Light"> <item name="colorPrimary">#212121</item> <item name="colorPrimaryVariant">#000000</item> <item name="colorOnPrimary">#FFFFFF</item> <item name="colorSecondary">#2962FF</item> <item name="colorSecondaryVariant">#0039CB</item> <item name="colorOnSecondary">#FFFFFF</item> <item name="colorError">#F44336</item> <item name="colorOnError">#FFFFFF</item> <item name="colorSurface">#FFFFFF</item> <item name="colorOnSurface">#212121</item> <item name="android:colorBackground">@color/background</item> <item name="colorOnBackground">#212121</item></style><color name="background">#FAFAFA</color>
Note 1: Hex color codes are not currently supported for , hence why a color resource was used.
Note 2: Use and attributes to theme system bars.
The result can be observed in our playground screen:
Playground screen with global color attributes customized
A great way to quickly preview the appearance of primary/secondary colors is to use the Material Color Tool.
How to alternate row color in Google Sheets
In some cases you may want to color every other row in your spreadsheet, and this can be done in a much easier way than by manually selecting every other line before coloring.
To alternate row color in Google Sheets, select the range that you want to apply alternating colors to, open the «Fill color» menu, click «Alternating colors…», customize the options for styling, and then click «Done».
(If you want, you can also select the header or even the entire sheet)
If you prefer, you can also open the alternating colors menu without selecting a range first, and then type the range that you want to color in the «Apply to range» field. If you select the range before opening the menu, you will see that the «Apply to range» field will already be filled in.
When styling alternating colors, you can select a default style, or you can also specify which colors that you want to use.
You can also select whether or not you want there to be a special color for the header/footer.
If the color does not begin on the row that you want, for example if you want the color to be on even rows instead of odd rows… you can either adjust your source range by one row, or flip the colors assigned to «Color 1» and «Color 2» in the menu.
In this example the range that we are applying alternating colors to is A2:D9.
Buttons
Material Buttons include four main variants that all inherit from the base style, each with an optional style suffix: raised (default, no suffix), unelevated (), outlined () and text (). All button variants use the theme attribute for their typography styles.
The key attributes for customizing these styles are as follows:
- : The tint color applied to the button background. The default enabled color is transparent for text buttons and for all other variants.
- : The tint color applied to an optional button icon. The default enabled color is for text buttons and for all other variants.
- : The color of the button touch ripple. The default color is for raised/unelevated buttons and for outlined/text buttons.
- : The color of the stroke around the button background. The default color is for outlined buttons and transparent for all other variants.
- : The width of the stroke around the button background. The default value is 1dp for outlined buttons and 0dp for all other variants.
- : The shape appearance of the button background. The default value is .
The base button style (used by the widget class) can be customized and applied globally like so:
<style name="AppTheme" parent="Theme.MaterialComponents.Light"> ... <item name="materialButtonStyle">@style/AppButton</item></style><style name="AppButton" parent="Widget.MaterialComponents.Button"> <item name="backgroundTint">?attr/colorSecondary</item></style>
The result can be observed in our playground screen:
Customized Button widget styles
How to sum values by color
Say, I’m keeping track of classroom equipment orders. I denote the ordered things by yellow background color, items on the way by blue, and delivered equipment by green:
My task is to see how many desks, computers, and other supplies are on the way at the moment. Color is the only difference these numbers have in my table. So I open the tool to sum by color and use the following settings:
- I select the entire range with my data to check it.
- I pick C2 as a pattern cell to specify the format of items I want to calculate.
- Select the SUM function to add up the numbers from the green cells.
- Pick cells to place the resulting calculations for each item.
- To see the number of shipped items for every product, apply the function to each row.
Click Insert function to get the formula after each line in your table.
The convenience of getting the formula is that you can modify any of its parts and paste it wherever you need in your Google spreadsheets.
Material Design Websites
1. Google
When it comes to Material Design, how can we not mention Google? It’s the best practice of its own material design guidelines. The material design style is characterized by the clean typography and simple layout that is easy to understand so the user can focus on content.
2. WhatsApp
WhatsApp is a timely communication tool loved by people around the world, implements the concept of material design in its web design and mobile App design very well. In terms of colors, WhatsApp did not use a very colorful palette for its main colors, opting for a more serene mix of gray and green.
These Material Design color tools and resources will help you move to the next step in practicing building your website or App.
Actually, it’s not that hard. To create a website or App that incorporates Material Design, you only need a material design style prototyping tool. Here I give my vote to Mockplus as it has the unique advantage of both in website prototype design and mobile App prototype design. Combining the built-in material design components of Mockplus with the material design color scheme I summarized for you above, designing a Material design style application or website is no longer a difficult task.
Немного истории
Сегодня мы привыкли к тому, что интерфейсы Google выглядят и работают примерно одинаково. Но так было не всегда. Еще десять лет назад приложения для Android, десктопная почта и мобильный веб были похожи друг на друга не больше, чем крот на пианино.
В 2011 году в Google решили, что с этим пора что-то делать, и действительно что-то сделали. А именно — унифицировали свои продукты, создали единый стиль для приложений Android Holo. Только вот они снова оказались разными.
В результате пользователи все так же терялись при переключении между мобильным и десктопным интерфейсами: выглядели они по-разному, управлялись тоже — проблема оставалась.
Gmail.com (Kennedy)
Gmail for Android (Holo)
How to remove color from cells in Google Sheets
Removing color from cells, is in most cases almost exactly the same process as adding color.
To remove color from cells in Google Sheets, select the cells/rows/columns that you want to remove color from, open the «Fill color» menu, and then click «Reset». You can also simply click the color white if you prefer.
Another way to remove color from cells, including any color that is applied through conditional formatting or alternating colors, is to clear the formatting of selected cells by doing the following:
- Select the cells that you want to clear color/formatting from
- Click the «Format» menu in the toolbar
- Click «Clear formatting»
(Using «Clear formatting» will clear ALL/ANY formatting from the cells)
Now you know lots of different ways to color your spreadsheets, so that you can make your finished work visually appealing and very easy to read!
Palette colors
A color intention is a mapping of a palette color to a given intention within your application.
The theme exposes the following palette colors (accessible under ):
- primary — used to represent primary interface elements for a user. It’s the color displayed most frequently across your app’s screens and components.
- secondary — used to represent secondary interface elements for a user. It provides more ways to accent and distinguish your product. Having it is optional.
- error — used to represent interface elements that the user should be made aware of.
- warning — used to represent potentially dangerous actions or important messages.
- info — used to present information to the user that is neutral and not necessarily important.
- success — used to indicate the successful completion of an action that user triggered.
If you want to learn more about color, you can check out the color section.
Typography
Type attributes adhere to the Material Type System in terms of text typeface, weight, size, case and letter spacing. The attributes reference styles that implement (and are named after) the various type scales:
- : Light, 96sp
- : Light, 60sp
- : Regular, 48sp
- : Regular, 34sp
- : Regular, 24sp
- : Medium, 20sp
- : Regular, 16sp
- : Medium, 14sp
- : Regular, 16sp
- : Regular, 14sp
- : Regular, 12sp
- : Regular, 14sp, all caps
- : Regular, 12sp, all caps
The Material Components widgets will use these styles as per the Material guidelines.
You would typically want to keep the default weight, size, case and letter spacing for each style. However, a custom typeface can really make your app stand out. One might assume this requires overriding each and every one of these attributes. Thankfully, this can be done in a far more concise way by adding the following attributes to your app theme:
<style name="AppTheme" parent="Theme.MaterialComponents.Light"> ... <item name="fontFamily">@font/roboto_mono</item> <item name="android:fontFamily">@font/roboto_mono</item></style>
These attributes reference an XML Font or a Downloadable Font that you’ve added to your folder and will apply a custom typeface to every widget and text style in your app. There was certainly a time when it wasn’t this easy on Android!
If you do, however, wish to customize one of the Material Components text appearance styles, you would do so like this:
<style name="AppTheme" parent="Theme.MaterialComponents.Light"> ... <item name="textAppearanceButton">@style/AppTextAppearance.Button</item></style><style name="AppTextAppearance.Button" parent="TextAppearance.MaterialComponents.Button"> ... <item name="android:textAllCaps">false</item></style>
The results can be observed in our playground screen:
Playground screen with global type attributes customized
Lastly, Google Fonts is a great place to start if you’re looking for free-to-use, custom typefaces (which happen to work really well with Downloadable Fonts too).
Customization¶
Custom colors
Source · Difficulty: easy
Material for MkDocs implements colors using CSS variables (custom properties). If you want to customize the colors beyond the palette (e.g. to use your brand-specific colors), you can add an and tweak the values of the CSS variables.
Let’s say you’re YouTube, and want to set the primary color to your brand’s palette. Just add:
See the file containing the color definitions for a list of all CSS variables.
Custom color schemes
Source · Difficulty: easy
Besides overriding specific colors, you can create your own, named color scheme by wrapping the definitions in the , which you can then set via as described in the section:
Additionally, the color scheme defines all of it’s colors via color functions and deduces its colors from the CSS variable. You can tune the theme with:
Cards
Material Cards are considered to be “surfaces” and make use of the style. The key attributes for customizing them are as follows:
- : The color of the card background. The default color is .
- : The elevation of the card. The default value is 1dp.
- : The shape appearance of the card background. The default value is .
The base card style (used by the widget class) can be customized and applied globally like so:
<style name="AppTheme" parent="Theme.MaterialComponents.Light"> ... <item name="materialCardViewStyle">@style/AppCard</item></style><style name="AppCard" parent="Widget.MaterialComponents.CardView"> <item name="cardElevation">8dp</item></style>
The result can be observed in our playground screen:
Customized Card widget style
How to change text color in Google Sheets
Changing the color of text in your spreadsheet is almost the exact same as changing cell background color, except that you must click a different menu to begin with.
To change text color in Google Sheets, select the range of cells that contain the text/values that you want to color, open the «Text color» menu, and then select the color that you want.
Like with changing the color of cells, when changing text color you can select a single cell, a range, a row, or a column… and then change the color to anything that you want.
In this example we are going to color the text in cell C6 red, rather than changing the color of the cell itself, which we did in the first example.
To do this simply select cell C6, then open the «Text Color» menu, and then select the color red.
Update the results
Do you remember that Google Sheets don’t have functions that work with color? This means they don’t count changes to cell formatting as a reason to re-calculate your formula results. The good news is that both workarounds you can use are very simple.
- You can change any value within the calculated range. Say, you are counting green cells in A1:C254. You can simply add a character to any of the cells in this range, and then remove it to get the updated results.
- If you have a lot of valuesByColor formulas in your sheet, click on the Refresh option that is right under the Function by color in Power Tools to update all formulas in one go.
Material Bottom Navigation includes two main variants that inherit from the base style, with an optional style suffix: surface (default, no suffix) and colored (). Bottom Navigation labels use the theme attribute for their typography styles.
The key attributes for customizing these styles are as follows:
- : The color of the bottom navigation background. The default color is for surface bottom navigation and for colored bottom navigation.
- /: The colors of bottom navigation item icons and labels. The default colors are /(selected) for surface bottom navigation and for colored bottom navigation.
- : A flag to set whether or not a translation animation should occur when selecting bottom navigation items. The default value is false.
The base bottom navigation style (used by the widget class) can be customized and applied globally like so:
<style name="AppTheme" parent="Theme.MaterialComponents.Light"> ... <item name="bottomNavigationStyle">@style/AppBottomNavigation</item></style><style name="AppBottomNavigation" parent="Widget.MaterialComponents.BottomNavigation.Colored" />
The result can be observed in our playground screen:
Customized Bottom Navigation widget style
This is certainly not exhaustive. A more comprehensive list of all components and their attributes can be found in the Material Components for Android Docs.
Build a Material Theme
The Material Components for Android library includes a module that allows you to easily customize an existing Material Theme. It provides you with a set of XML files (/, and ) which include all of the necessary baseline theme attributes mentioned in this article. The values can be tweaked and previewed in a corresponding sample app. When you’re happy with the chosen values, the files can be dropped into a new/existing Android Studio project. A web version is also available on Glitch.
The “Build a Material Theme” sample app
More resources
- The source code for the Playground app used in this article can be found on GitHub
- “The Components of Material Design” — A great presentation by Cameron Ketcham and Gautham Sajith at Android Dev Summit 2018, covering a brief history of Material Design and how to use Material Components for Android
- “Designing and building a real Android app using Material Tools & Components” — A presentation I gave at Droidcon Kenya and DevFest South Africa 2018, covering how I designed and built Rugby Ranker using the Material Theme Editor Sketch Plugin, Material Gallery and, of course, Material Components for Android
- Material Design Codelabs