i

[ASAP] Scaffold Repurposing of in-House Chemical Library toward the Identification of New Casein Kinase 1 d Inhibitors

ACS Medicinal Chemistry Letters
DOI: 10.1021/acsmedchemlett.0c00028




i

[ASAP] Development of a Raltegravir-based Photoaffinity-Labeled Probe for Human Immunodeficiency Virus-1 Integrase Capture

ACS Medicinal Chemistry Letters
DOI: 10.1021/acsmedchemlett.0c00009




i

[ASAP] Substituted Azabicyclo[2.2.1]heptanes as Selective Orexin-1 Antagonists: Discovery of JNJ-54717793

ACS Medicinal Chemistry Letters
DOI: 10.1021/acsmedchemlett.0c00085




i

[ASAP] De-risking Drug Discovery of Intracellular Targeting Peptides: Screening Strategies to Eliminate False-Positive Hits

ACS Medicinal Chemistry Letters
DOI: 10.1021/acsmedchemlett.0c00022




i

[ASAP] Synthesis and Evaluation of <sup>11</sup>C- and <sup>18</sup>F-Labeled SOAT1 Inhibitors as Macrophage Foam Cell Imaging Agents

ACS Medicinal Chemistry Letters
DOI: 10.1021/acsmedchemlett.0c00127




i

[ASAP] Ligand Design for Cereblon Based Immunomodulatory Therapy

ACS Medicinal Chemistry Letters
DOI: 10.1021/acsmedchemlett.0c00214




i

Germany Facing Mass Blackouts Because The Wind And Solar Won’t Cooperate

Germany’s energy network nearly broken down in January because of poor execution from wind turbines and sun based boards, as indicated by information from a noteworthy exchange union. Wind and sunlight based power plants failed to meet expectations in January, 2017, as a result of shady climate with almost no wind, setting the phase for …

The post Germany Facing Mass Blackouts Because The Wind And Solar Won’t Cooperate appeared first on LatestSolarNews.




i

Tanzania turns to solar power to increase electricity connectivity

As many as 60 percent of the Kenyan population now has access to electricity according to official data. But in neighbouring Tanzania, the penetration rate is less than half of that and sparsely populated rural communities are especially neglected.  

The post Tanzania turns to solar power to increase electricity connectivity appeared first on LatestSolarNews.




i

China’s New Large Solar-Powered Drone Reaches 20,000 Meters in Altitude

China’s first domestically designed large solar-powered unmanned plane reached above 20,000 meters in altitude on its test flight in the country’s northwest regions recently. The drone was developed by the China Academy of Aerospace Aerodynamics (CAAA), it’s developers kept the exact size of the drone as a secret, but it is believed to be about 14 …

The post China’s New Large Solar-Powered Drone Reaches 20,000 Meters in Altitude appeared first on LatestSolarNews.




i

Solar Trees Powering The Park Of South Florida

Joining South Florida’s lush, green canopy of real trees are a new crop of solar trees. These “trees” have blue trunks and bear no fruit, but supply clean energy to whoever needs it. If you’re at the beach and your phone starts to die, you can charge it right here using Solar Power. Here’s how …

The post Solar Trees Powering The Park Of South Florida appeared first on LatestSolarNews.




i

Solar Powered Lights For The Yard

Reading about the various sofas reviews here and choosing amongst them to match your patio is not that difficult when compared to doing the entire electrical work of the patio. When you are lighting your patio the exact opposite thing you need to do is to be stumbling over electrical lines and attempting to put …

The post Solar Powered Lights For The Yard appeared first on LatestSolarNews.




i

Sono Motors Introduces The SION Solar Powered Car

The fantasy of having the capacity to drive to work in a solar-powered car is at last turning into a reality. Sono Motors simply uncovered the SION solar-powered electric car gives you the ability to travel up to 18 miles utilizing only energy from the sun. Best of all, the SION isn’t only for the …

The post Sono Motors Introduces The SION Solar Powered Car appeared first on LatestSolarNews.




i

New Solar Plant In Chile To Power 13,000 Homes Per Year

Chile is building a brand new solar power plant that has some exciting outcome on the future. The plant is expected to provide energy on day and night as well as throughout inclement weather, to power up to 13,000 homes annually. This project will make Chile one of the top solar energy spots in the …

The post New Solar Plant In Chile To Power 13,000 Homes Per Year appeared first on LatestSolarNews.




i

Construction has started on the largest solar project in Nepal

The reports say that the constructions of a 25MW largest solar PV project in Nepal has begun. The foundation stone was laid last week at Devighat in Nuwakot by Minister for Energy, Water Resources and Irrigation, Barsha Man Pun. The government plans to finish the construction of the project in a year. As stated by …

The post Construction has started on the largest solar project in Nepal appeared first on LatestSolarNews.




i

4 Benefits Of Solar LED Lights For Parking Lots

The future is solar LED lights. You will see them in the parking lots and other large areas around a city. They are cheap and save a good deal of money on electricity bills. Nowadays, the majority of parking lots feature the conventional lights that get their power from the grid. These products are not …

The post 4 Benefits Of Solar LED Lights For Parking Lots appeared first on LatestSolarNews.




i

India is planning to achieve 50 GW of prodction from renewbale energy by 2028

India is planning to achieve 50 gigawatt (GW) of production from renewable energy by 2028, in order to get to its goal of 40 per cent of electricity generation from non-fossil fuels by 2030, Ministry of New and Renewable Energy secretary, Anand Kumar said at the India-Norway Business Summit 2019 in New Delhi. Of this …

The post India is planning to achieve 50 GW of prodction from renewbale energy by 2028 appeared first on LatestSolarNews.




i

Ugly Duckling Presse




i

A BEM syntax with UX in mind

At some point, while working on the MontageJS framework, the question came up what CSS naming convention we should start using. After a long discussion we settled on using the BEM methodology, but changed the syntax a bit. To keep this post short, I won’t go into detail why using BEM is a good idea, but rather explain why we chose a different syntax. Here some examples:

.digit-Progress          /* org-Component */
.digit-Progress-bar      /* org-Component-childElement */
.digit-Progress--small   /* org-Component--variation */

Note: The org- (digit-) prefix is used as a name-space so it wouldn’t conflict with other packages/libraries/frameworks.

Now let’s take a look at the reasons for choosing such a syntax.

Hyphens (-)

The main reason why we’re using a hyphen (-) instead of underscores (_), has to do with the fact that their behavior is different when double-clicking to select text. Try for yourself:

component__element /* underscores */
component-element  /* hyphen */

See how when you’re using underscores it selects the part before and after, in this case the whole component__element. But with hyphens it let’s you select only the part you double-clicked. component OR element. This let’s you quickly edit only the parts you want:

camelCase

Now, what if the component or child element consists of multiple words? We could use underscores like component_name-element_name. It would still be double-clickable, but readability suffers since it’s harder to see what belongs together. Better to use camelCase which groups each part visually: componentName-elementName.

MainComponent

OK, I think we’re getting closer. As a last rule, for the “main” component we use PascalCase. The reason for it is to add emphasis and make it easier to distinguish the main component from a child element. Also when using a namespace, the component moves to the second position, which makes it even more important to have it stick out: org-Component-childElement

–variation

We kept the more commonly used double hyphens (–) for variations. digit-Progress--small. It makes sense, because it pulls the variation (–small) visually more apart and makes it look like it’s something “different” than the default component.


So that’s about it. For more details about this naming convention, take a look at the SUIT framework, which also started to use the same syntax and documented it really well.

In the end, whatever Shade of BEM you choose to cook with probably depends on your personal taste, but thinking about a great UX by improving usability and readability won’t hurt either.




i

Moving to Jekyll

I haven’t redesigned my site for years, can’t even remember exactly. Also, haven’t been posting for a while. So as a New Year’s resolution I redid my site using Jekyll and am hosting it as a GitHub page.




i

Styling with STRINGS

At this year’s CSSConf in Melbourne (AU) I gave a talk called “Styling with STRINGS”. The talk is about how we can use Flexbox, currentColor and __EM__s inside components to quickly style entire Web Apps straight in the browser.

In case of tl:dw here some of the main points:

Layout

When creating mobile “App” layouts, where not the whole page is scrollable, but instead only certain parts. And you have anchored areas like header/footer and a main area that should fill out the available space, then the easiest way is to use Flexbox.

This lets you easily drag around components that are set as flex items and they always position nicely. Using flex: 1; on components makes them stretch out and fill the available space. A good use case is a search input or a title.

Color

If you don’t specify the border-color (initial value) it will be the same value as color.

Furthermore there is a color value called currentColor. As the name indicates, it’s also mapped to the current color value. We can use it as background-color for example. Not that useful when the text should be readable, since now text and background are the same color, but for some components without text it can be quite useful. Like in the example below with the slider thumb.

If a component set should look similar to the “iOS 7” style then currentColor works great. Below all components have no color values at all and only use currentColor. This let’s us change everything by only changing the color value in the root html element.

Size

In a similar way, EMs are mapped to font-size. So if we use EMs to define only the proportions of a component, we can use font-size to scale it up/down. And if we inherit the font-size we could also control everything at once with just a single property in the root or in groups if we go deeper down the DOM tree.

REMs work the same except that they are tied to the root html element only. We could use it to control the spacing of the components by using REMs for margin/padding.

I wrote about this in more detail in the Sizing (Web) Components post.

All together

Now if we combine this all and test it in an example application, we can easily design many variations right from the DevTools/inspector in a quick and easy way.

Feel free to play around with the CSSConf App yourself or check out the source on GitHub.

How to save?

You might wonder how you can save the changes made in the DevTools/inspector without having to manually copy them over into your CSS file. In Chrome there is a feature called Workspaces. It let’s you map a URL to a local folder. Once that is setup, all CSS changes will automatically be saved to your local disc. Here a post that explains how to setup Workspaces. It’s advised to use version control like Git, so that you can always discard all changes if you went too far and wanna start over.

Conclusion

Admittedly it is somewhat in between of being useful for production and just a “hack”. Especially the currentColor. But the main point of the talk is best told by this quote:

“Creators need an immediate connection” — Bret Victor

The examples I used are just the closest I could get using CSS alone and still keep code clean. I hope we keep that principle alive and improve on it.


ps. Artist of the puppet master illustration: Unknown.

pss. Here all the other videos from CSSConf.




i

Spacing elements

So let’s say we have a “bar” with some items inside. Like a header or footer. Let’s also say we want those items to be spaced evenly, meaning they have the same gap everywhere. Shouldn’t be a big problem. Let’s take a look:

1. Margin

We can’t just add margin: 2rem to the elements since there is no margin collapsing on the horizontal axis. And it also doesn’t work when using Flexbox. Leaving a double sized gap in between. Wishing there is something like margin: 2rem collapse; where you can enable/disable it optionally.

See the Pen Spacing elements (no collapsing) by simurai (@simurai) on CodePen.

2. Pseudo classes

Using margin: 2rem 0 2rem 2rem and then a pseudo class like :last-child { margin-right: 2rem } to add the extra margin works as long as you don’t need to hide that element with display: none. Maybe a rare case, but I’ve been running into this issue once in a while. Would be cool if there is something like :last-displayed that would ignore elements that have display:none.

See the Pen Spacing elements (pseudo) by simurai (@simurai) on CodePen.

3. Margin + padding (best)

The easiest way I think, is to add margins to all elements (like in the first example), but then also add the same value as padding to the parent element. Like this:

.Header {
  padding: 1rem;
}
.Header-item {
  margin: 1rem;
}

That way all elements are evenly spaced and you still can use display:none without having to worry about breaking it. A little flaw is that you have to keep the 2 values in sync, but if you’re using a preprocessor, it can just be a single variable. Or maybe you could use REM’s to control it with font-size from the :root.

See the Pen Spacing elements by simurai (@simurai) on CodePen.

Other?

There are more ways but I’m not aware of a simple one that also let’s you use display: none. Let me know otherwise.

Update

A couple more options:

Hmmm.. gotta try some. I kinda like the 3rd one. Keeps it independent from the parent and is not “too” complicated.




i

Filtering (photo) filters

A lot of photo apps allow you to add filters before sharing. The typical UI for picking a filter is a row of little thumbnails that can be horizontally scrolled. I’m sure you’ve used it many times. It looks something like this:

The problem

A filter picker like that is easy to understand and works pretty well. But in my case, there is something that has been bugging me a bit. Here is how I use it:

  1. I start with the first thumbnail and then just keep tapping one after the other.
  2. If there is a filter that I like, I try to remember its name. And somewhat its position, but more like “somewhere at the beginning”.
  3. Then once I reach the end, I start scrolling back trying to find the ones I liked.
  4. Usually there are like 2-3 filters that I would like to quickly compare before making my final choice. But it’s quite hard to scroll between them, especially if they are far apart. Also having to remember their name/position costs some precious brain power.

Now, I don’t really know how most people use these filter pickers. Could be that:

  1. Most people just stop once they found a filter they kinda like and don’t bother trying the rest.
  2. Or some have a few favorites and know their name/position already.
  3. You could also just look at the little thumbnails. But some filters are very similar and I need to see them on the actual photo to judge.

Possible solutions

So I was thinking about some possible improvements:

1. Order by popularity

Automatically order the filters based on how often they get used. This makes filters that you use most appear at the beginning and are easier to get to. You could always keep scrolling in case you’re in the mood for something new. This would of course mess it up for people that have filters remembered by position. But not sure how many actually do that.

2. Manual re-order

Let people manually reorder the position. Could be done similar like the home screen icons on iOS (long press until they wiggle, then drag around). I would probably move my favorites to the front and also sort based on color/style.

3. Narrow down

Let people temporarily toss away the filters they don’t want. This would allow you to narrow down your selection to just a few for easier comparison. Of course, all the filters would be back next time you take a new photo.

Or probably even better (3B): Instead of throwing away the ones you don’t like (could be tedious if there are a lot of filters), you could push up only the ones you like and they would move to the right with a visual separator. It’s similar how you can pin a Chrome browser tab to separate it from the rest. Then once you scrolled to the end, you would have all your previously selected filters next to each other, waiting to be the lucky winner.

Conclusion

I understand that the suggestions might make a photo app more complicated and harder to explain to a new user. But it could be more a “power user” feature that you’re not forced to use if you don’t want to. Anyways, in case I’m not the only one with this (small) problem, I hope some day we will have a better way to filter filters. Ohh.. and let me know if you’re already using an app that tackles this somehow.

Update

Thanks for all the comments. Good to see more people thinking about this. I played around a bit more with the demo, mostly after the conversation with Ignacio in the comments below. So here a 4th option:

4. Select and cycle

Let people select a couple filters and then cycle through them by tapping on the photo. It’s actually similar to 3B, but it keeps the UI simple by using the photo as the secondary navigation control. Here the steps how to use:

  1. You can tab each filter until you find one you like.
  2. If you tab a 2nd time on that filter, it gets selected as a “favorite”. It will move up a little to visualize it.
  3. You can keep trying other filters and mark more as favorites.
  4. Once you reached the end (or think you have enough), you can tap on the photo above the filter picker to quickly cycle through all your previously selected (favorited) filters. Now comparing different filters is really quick and easy.

Try the demo.

The implementation of the demo could still be improved. It is a bit hard to discover that you can tap the photo to cycle through your favorites. Might need some visual clue to help understand it better. Adding swipe gestures instead of tapping would also improve UX. Or to remove a filter from your favorite selection, you could just swipe down on the image. Also note that the filters are CSS based and still a bit glitchy when animating. But you should get the idea.

Update II

Manuel Haring explored a similar concept where you can push up filters to narrow down your selection.

Here a larger video that has even a third selection stage.




i

FrontLinks

This is my (living) collection of front-end links. It’s not complete by all means, in fact, there isn’t any of the obvious ones, like Can I use or so. Just some links that I need occasionally but can’t remember their names, so I saved them here for quick access. Also, they’re somewhat randomly ordered.

Note to self: Edit source

Docs

CSS

Libs + Frameworks

Utils + Tools

Resources




i

Nesting Components

Using CSS components is somewhat straightforward. We add the markup and give it the component’s class name and all is good. Where it gets trickier is when we try to nest components. And when they need to be tweaked based on the context. Where should the styles be defined? It’s a question I’ve been asking myself a few times and what this article is trying to explore.

Just to clarify before we start, with “CSS components”, I mean the small building blocks that get used to assemble a website or app. Like buttons, inputs, navs, headers etc. Some also call them modules or patterns. Also I’m using the SUIT naming convention in the examples below, but any other convention would be fine as well. And just a heads, there isn’t some awesome solution at the end that solves all the problems. It’s just me whining most of the time.

Ok, best is to go straight into it and look at an example. Let’s say we have a Header component where we would like to add a Button component inside.

<header class=“Header”>
  <button class=“Button”>Button</button>
</header>

Now because the Button is inside the Header, we want to make the Button a bit smaller than it would be on its own.

Here a few approaches how to do that:

Option 1 - Descendant selector

Maybe the most common way is to use a descendant selector to change the font-size whenever a Button is inside a Header.

.Header .Button {
  font-size: .75em;
}

This works great but the question is, where should this rule be added? We probably split our components into separate files, so is it in header.scss or in button.scss? In other words, should the Header know about what other components might get nested or should the Button know in what environment it will get placed?

But wait, the point of creating components is to separate them, make them modular. Each component should be kept isolated and shouldn’t know about other components. So we can make changes, rename or remove them without having to check if they might get used somewhere else.

Option 2 - Variations

Another way is to create variations. We add a .Button--small class that we can use whenever we would like the button to be smaller without having to worry about ancestors.

.Button--small {
  font-size: .75em;
}
<header class=“Header”>
  <button class=“Button Button--small>Button</button>
</header>

This works great too, but could get out of hand quickly. What do you do if at some point you want the font-size to be .9em? Create yet another variation? Button--justALittleSmaller. As the project keeps growing, the number of variations will too. We will start to loose sight where they actually get used and we’re not sure anymore if we can change a variation or if it will have side effects in some other place. We could create “contextual” variations like Button--header or Button--footer, but then we’re back at the beginning and could just as well use “descendant selectors”.

Same goes for using states. .Button.is-small should only be used if there is a change in state and not to fit a certain context.

Option 3 - Adopted Child

I can’t remember where I read about this approach but somehow it stuck with me. I also forgot how it was called. So for now I’ll just call it “Adopted Child”.

Let’s switch it around and look at it from the Header’s perspective. What would we do if we wouldn’t know what the components are called that might get nested? But we know that we want to make them a bit smaller. Well, we probably would create a generic .Header-item class and use it like this:

.Header-item {
  font-size: .75em;
}
<header class=“Header”>
  <div class=“Header-item”></div>
</header>

Ok, that gets us a bit closer. Now, it’s probably strange saying it like that when talking about CSS, but what would we do if we don’t want to create an own child, but still have one. Right, we could adopt one. In our example we adopt a Button component as our own child. We didn’t create it, but now we can tweak.. erm.. I mean “raise” it like it’s our own:

// born in button.scss
.Button {
  font-size: 1em;
}

// raised in header.css
.Header .Header-item {
  font-size: .75em;
}
<header class=“Header”>
  <button class=“Header-item Button>Button</button>
</header>

It is a bit uncommon that the same HTML element shares classes from two different components. And it’s not without any risks. More about them later. But I really like this approach because it keeps the components independent without having to know about each other.

Another nice thing is that if we want to add other components to the Header that also need the same adjustments, we can reuse the same Header-item class, like for example on a text Input.

<header class=“Header”>
	<input class=“Header-item Input>
  <button class=“Header-item Button>Button</button>
</header>

Ok, about those risks. Well, depending on what properties we wanna change, it might not always be ideal. For example, because the Button already had font-size defined, we had to increase specificity by using .Header .Header-item. But that would also override variations like .Button--small. That might be how we want it, but there are also situations where we’d like the variation to always be “stronger”. An example would be when changing colors. When the color of Buttons should be different inside a Header, but not when its a variation, like .Button—primary. Yeah, we could take a look inside button.scss or our style-guide, but remember our goal.. we actually don’t want to make decisions by looking how other components are made.

So, as a general rule, don’t use “adopted children” for any properties that are theme related and only where you can be sure that you want to override them all the time. Like for layout/size related properties or adjusting the position.

More options?

There are some more ways to do contextual styling that came to mind. I’ll just mention them briefly for completeness, but think the 3 above are better suited.

Option 4 - We could use a preprocessor to extend an existing component. In our example it would be a clone of the Button with some tweaks added and used as a new child component .Header-button. Now we only rely that the Button exists in the source, but don’t have to worry about other contexts. Downside is inflating our CSS output. As well as having to remember lots of new child component classes.

Option 5 - We could create a utility class like .u-small. It’s similar to variations, but not scoped to a single component and could be used for other components as well. And for that reason it becomes very risky to ever change later.

Option 6 - And of course, we could use inline styles. But I would leave that to JavaScript only.


So after all that, which is best? I’m afraid there isn’t a clear winner. It would be nice to keep it consistent with a single approach throughout the entire project, but I guess we just have to decide on a per case basis:

  1. Descendant selectors if we can expect that components don’t change much. Like when using a UI Kit or library.
  2. Variations if it makes sense that a component has different versions that get reused anyways, and not just for a specific context.
  3. Adopted Child for layout, sizing, positioning or where we are sure to always want to override a property. Also for changing multiple child components at once.
  4. Extending when we truly want the components to be separated and don’t mind inflating the CSS output.
  5. Utilities for very specific things, that once the class is defined, it will never change, like clearing floats.
  6. Inline styles if it needs to be dynamically added with JavaScript.

As said at the beginning, I haven’t found a “fits all” solution and maybe the conclusion is: Try to keep contextual styling to a minimum.

Updates

The “Adopted Child” approach is called “Mixes” in BEM. Here some more infos.


SUIT also recommends using “Adopted Child/Mixes”. But also another option:

Option 7 - Adding a wrapper element. It’s the <div class="Excerpt-wrapButton"> in that example. I think it works great in most cases. But for example when using Flexbox, because it has this parent/child relationship, adding an extra wrapper in between would break it. And then you might still need to set the width of the wrapped component to 100% or so. Anyways, this is a great addition. Thanks Pablo in the comments.


Option 8 - Single Purpose Classes. It’s where every class has only a single property. It’s somewhere between utilities (Option 5) and inline styles (Option 6). Atomic CSS and Tachyons use this approach. I haven’t used them on a real project, but just from looking at it, the concerns are similar to the ones from utilities. If you want to change the value in a SP class, it seems unpredictable. Because in another place (where that same class is used), you might want to keep the current value. So you would have to first check if the change has any unwanted effects somewhere else.




i

Contextual styling with custom properties

Something I’ve been wanting for a long time, define different regions like a footer section, or side bar and not have to deal with all the contextual styling hassle. A.k.a. “Now that this button is used on a dark background, the button needs to change its colors too. Where should the styles live?”. Here an old post about struggling with contextual styling.

So then the other day I was doing some experiments with using custom properties for Atom’s UI. Turns out, using custom properties might make contextual styling a bit easier. For the rest of the post, let’s switch to a more simple example. A page where the main area is light, but then has a dark hero and footer section. Like this:

In the past, I probably would’ve created variations like Button--dark or overwrote it with header .Button {…}. Depends a bit on the project. Here another approach: Create themes with a set of variables, then apply the theme to the different areas.

1. Default theme

First let’s define our default theme with a bunch of variables.

[data-theme="default"] {
  --fg:         hsl(0,0%,25%);
  --border:     hsl(0,0%,75%);
  
  --bg:         hsl(0,0%,95%);
  --button-bg:  hsl(0,0%,99%);
  --input-bg:   hsl(0,0%,90%);
}

Then we create some components where we use the variables defined above.

[data-theme] {
  color: var(--fg);
  background-color: var(--bg);
}

.Button {
  color: var(--fg);
  border: 1px solid var(--border);
  background-color: var(--button-bg);
}

.Input {
  color: var(--fg);
  border: 1px solid var(--border);
  background-color: var(--input-bg);
}

And lastly we add the [data-theme="default"] attribute on the body so that our components will pick up the variables.

<body data-theme="default">

If you wonder why use data-theme attributes over classes? Well, no specific reason. Maybe with attributes, it’s a hint that only one theme should be used per element and is more separated from your other classes.

At this point we get this:

See the Pen Contextual styling with custom properties (1/3) by simurai (@simurai) on CodePen.

2. Dark theme

But our designer wants the hero and footer to be dark. Alright, let’s define another theme region.

[data-theme="dark"] {
  --fg:         hsl(0,10%,70%);
  --border:     hsl(0,10%,10%);
  
  --bg:         hsl(0,0%,20%);
  --button-bg:  hsl(0,0%,25%);
  --input-bg:   hsl(0,0%,15%);
}

And add the theme attribute to the header and footer.

<header data-theme="dark">
<footer data-theme="dark">

Which gives us this:

See the Pen Contextual styling with custom properties (2/3) by simurai (@simurai) on CodePen.

The reason why this works is that custom properties cascade and can be overridden on nested elements, just like normal properties.

3. Hero theme

A few months pass and our designer comes back with a redesigned hero section. “To make it look fresh” with a splash of color.

No problem! Just like with the dark theme, we define a new “hero” theme.

[data-theme="hero"] {
  --fg:         hsl(240,50%,90%);
  --border:     hsl(240,50%,10%);
  
  --bg:         hsl(240,33%,30%);
  --button-bg:  hsl(240,33%,40%);
  --input-bg:   hsl(240,33%,20%);
}
<header data-theme="hero">

And here is that fresh hero:

See the Pen Contextual styling with custom properties (3/3) by simurai (@simurai) on CodePen.

It’s also not limited to colors only, could be used for sizes, fonts or anything that makes sense to define as variables.

Benefits

Using these theme “regions” lets your components stay context un-aware and you can use them in multiple themes. Even on the same page.

  • Developers can add components, move components around, without having to know about in what context (theme) they live. The markup for the components stays the same.
  • Design systems authors can create new components without worrying about where they get used, the variables used in components stay the same.
  • Designers can define new theme regions, or change existing ones, without having to make changes to a component’s HTML or CSS, it stays the same.

Less time to talk about who, how and where, more time to talk about the weather. ☔️????

Concerns

Yeah, right. The big question: But does it scale? Can this be used for all use cases.

Ok, I’m pretty sure it doesn’t fit all situations. There are just too many to find a single solution for them all. And I’m actually not sure how well it scales. I guess it works great in these simple demos, but I have yet to find a larger project to test it on. So if you have used (or plan to use) this approach, I’m curious to know how it went.

A concern I can imagine is that the list of variables might grow quickly if themes have totally different characteristics. Like not just a bit darker or lighter backgrounds. Then you might need to have foreground and border colors for each component (or group of components) and can’t just use the general --fg and --border variables. Naming these variables is probably the hardest part.

Update I

@giuseppegurgone made an interesting comment:

in suitcss projects I used to define component level custom props, theme variables and then create themes by mapping the former to the latter suitcss-toolkit

So if I understood it correctly, by mapping theme variables to component variables, you could avoid your theme variables from growing too much and you can decide for each component how to use these theme variables.

Update II

If it’s too early to use custom properties in your project, @szalonna posted an example how to do something similar in SCSS.




i

Unlock Your Team’s Potential With Teamstack

Teamstack is a password manager for your whole team. Running in the cloud it allows you to manage your tools and resources, and seamlessly scale your teams’ access, from a single, easy-to-use control panel. Teamstack is powerful, and secure with multi-factor authentication, single sign-in, SAML and form-based authentication. It works with desktop and mobile apps, […]




i

17 Tools for Effective Customer Engagement

The one thing that every business that offers a service has in common is its customers. It doesn't matter if you are a freelancer with just one client or a small design agency with a few clients, you have to deal with customers on a day to day basis.




i

Popular Design News of the Week: April 20, 2020 – April 26, 2020

Every week users submit a lot of interesting stuff on our sister site Webdesigner News, highlighting great content from around the web that can be of interest to web designers.  The best way to keep track of all the great stories and news being posted is simply to check out the Webdesigner News site, however, […]




i

The Latest Research for Web Designers, April 2020

Although life hasn’t returned to normal yet, the web design and marketing space doesn’t seem to have been too badly disrupted — at least not with all the new research and surveys floating around. And thank goodness for that. If we can maintain some semblance of normalcy, I think we’ll all get through this crisis in good shape.




i

Email Personalization: Your Secret To Better Engagement

One of the struggles that marketers face is how to send the right message at exactly the right time to target people in a way that will appeal to them. To solve the problem, businesses need to get themselves acquainted with new technologies and the power of personalization. In the past few years, digital marketing […]




i

Popular Design News of the Week: April 27, 2020 – May 3, 2020

Every week users submit a lot of interesting stuff on our sister site Webdesigner News, highlighting great content from around the web that can be of interest to web designers.  The best way to keep track of all the great stories and news being posted is simply to check out the Webdesigner News site, however, […]




i

3 Essential Design Trends, May 2020

The state of the world around us can greatly impact website design. From emotional changes that correlate to the feel of a design to information and data to deliver, the impact of the worldwide COVID-19 pandemic is making its way into projects (intentionally or not). Here’s what’s trending in design this month. 1. “Unbalanced” Use […]




i

8 of the Top WP Multipurpose Themes That You Can Use

More than a few multipurpose WordPress themes have become big sellers in recent years, and for a reason. Actually, for several reasons. One reason is they serve as excellent toolkits for web designers who have large and varied clienteles. The best multipurpose themes, like those presented here, are popular for other reasons as well. They […]




i

Thanks to Covid-19, Website Accessibility Has Never Been More Important

The first global pandemic of the digital era is upon us. We’re living in unprecedented and uncomfortable times. For our senior citizens, these past several weeks have been particularly discomforting. According to the CDC, men and women over the age of 65 are significantly more likely to develop complications from COVID-19. As we seek to […]




i

Women’s squad raises ₹20 lakh

The Indian women’s hockey team’s efforts to crowd-fund support for poor and migrant workers has raised ₹20,01,130 through an 18-day online challenge.T




i

Hockey | HI asks for bids to host various Nationals

State units can take part across age-groups




i

એપલે iફોન અને iપેડ માટે નવું ios 10.3 બેટા અપડેટ રિલીઝ કર્યું

એપલે થોડા સમય પહેલા જ એ વાત ને જાહેર કરી હતી કે, તે પોતાના ડેવલોપર્સ અને ટેસ્ટર માટે નવું ios 10.3 બેટા અપડેટ બહાર પાડવા ના છે. પરંતુ આ અપડેટ ને સામાન્ય લોકો સુધી પહોંચવા માં હજી ઘણો સમય લાગી જશે,




i

ગુગલ, માઈક્રોસોફ્ટે પોતાની પાઈરસી પોલિસીને કાબુ માં રાખવી પડશે, બ્રિટન IPO દ્વારા કોડ બ્રોક કરવામ

થોડા સમય બાદ, જે વેબસાઇટ્સ પર પ્રિન્ટેડ મટીરીઅલ રાખવા માં આવતા હશે તેને આગેવાન સર્ચ એન્જીન જેમ કે ગુગલ અને માઈક્રોસોફ્ટ ના ફ્રન્ટ પેજ પર નહિ બતાવવા માં આવે. આ સમાચાર આવ્યા છે એક ડીલ પર થી કે જે સર્ચ એંજીન્સ




i

The matter of photography in the Americas / Natalia Brizuela and Jodi Roberts ; with contributions by Lisa Blackmore, Amy Sara Carroll, Marianela D'Aprile, María Fernanda Domínguez, Heloisa Espada, Rachel Price, Diana Ruiz, Tatiane Santa Ro

Rotch Library - TR184.B75 2018




i

Design: the key concepts / D.J. Huppatz

Barker Library - NK1510.H87 2019




i

Library of light: encounters with artists and designers / Jo Joelson

Rotch Library - N8219.L5 J64 2019




i

The women of Atelier 17: modernist printmaking in midcentury New York / Christina Weyl

Rotch Library - NE538.N5 W49 2019




i

Huguette Caland / edited by Anne Barlow, Sara Matson and Giles Jackson ; texts by Anne Barlow, Brigitte Caland and Negar Azimi

Rotch Library - N6537.C329 A4 2019




i

Mathias Goeritz: modernist art and architecture in Cold War Mexico / Jennifer Josten

Rotch Library - N6559.G64 J67 2018




i

Legacy of the masters: painting and calligraphy of the Islamic world from the Shavleyan family collection / Will Kwiatkowski ; with contributions by John Seyller

Rotch Library - N6260.K87 2019




i

Usṭūrahʹhā va namādʹhā-yi āyinī dar nigārahʹhā-yi Saqānifārʹhā-yi Māzandarān / taʼlīf va gurdʹāvarī-i Muṣṭafá Rustamī, Fāṭimah Bābājānʹtabār Nashlī

Rotch Library - N7280.R888 2018




i

For your pleasure: Johannes Brus, photoworks and sculptures / with an essay by Clément Chéroux

Rotch Library - N6888.B745 A4 2018




i

Bauhaus imaginista: a school in the world / edited by Marion von Osten and Grant Watson

Rotch Library - N332.G33 B42724 2019




i

Anna Maria Maiolino, Entre pausas / texts by Anna Maria Maiolino, Tania Rivera and Randy Kennedy

Rotch Library - NC200.M27 A4 2018




i

Leonardo da Vinci: nature and architecture / edited by Constance Moffatt, Sara Taglialagamba

Rotch Library - N6923.L33 M64 2019