Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 8.2% on proxy.golang.org

proxy.golang.org : gitlab.com/toby3d/yac

Package yac helps to analyze icons and give out up to 4 colors (for example for background, font and button of app card) based and complementary icons colors. The color for the background of the card was selected automatically based on the icon, the button - translucent white. The algorithm tried to determine the main color of the icon, sorting the pixels by hue. Such an approach did not always give a beautiful result, it had shortcomings: The card was to be a real continuation of the icon. The colors are juicy and bright. We wanted to create the feeling that the card was carefully done by hand, and not slipped something carelessly generated automatically. We want to do more beautifully always, but the resources are not unlimited. To allocate a command to write a miracle library by definition of colors was not planned. So, the task: Take the icon. We discard white, black and transparent pixels. Reduce the resulting image to a size of 2 × 2 pixels (with anti-aliasing disabled). As a result, we get four colors for the icon. If the original picture is homogeneous, they can be repeated - it's okay. We have disabled anti-aliasing, so that colors do not mix, do not become "dirty". In fact, it turns out like this: the square is divided into four parts, we take the average pixel from the top row of each quarter. In the implementation of everything is simple: we do not even need a real downsample image and generally work with graphics. Pixels with the desired position are taken from a one-dimensional array obtained after the first step. Almost everything is ready. Remained quite a bit: get the resulting colors, translate to HSL, sort by lightness (L). We are painting a card. Light scheme: Dark scheme (if two or more colors are dark): Applying colors, check the contrast: Lightness difference between background and button ≥ 20; between the background and the text ≥ 60. If not, correct. We have got colorful cards, from real colors of icons, without "dirty" impurities. Due to the use of several colors, the card looks much livelier. It is especially pleasant that with a homogeneous icon background the card becomes its direct continuation: the border between them is not noticeable at all. And most importantly: we provided for special cases: Source: https://medium.com/@iammishaanikin/98b8f0dcfdc5

Registry - Source - Documentation - JSON
purl: pkg:golang/gitlab.com/toby3d/yac
Keywords: hacktoberfest, yandex
License: Apache-2.0
Latest release: over 5 years ago
First release: over 6 years ago
Namespace: gitlab.com/toby3d
Stars: 2 on GitLab.com
Forks: 0 on GitLab.com
See more repository details: repos.ecosyste.ms
Last synced: 24 days ago

    Loading...
    Readme
    Loading...