Background color html generator

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

A colorful css gradient background generator

License

webcore-it/colorful-background-css-generator

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

A colorful css gradient background generator

A pure javascript generator to create colorful css backgrounds.

Check this website to see the generator in action and play with the colors settings.

The idea is to have multiple layers of linear css gradients at different angles. The gradients go from color to transparent to let the lower layers shine through and generate the wanted effect. There is no limit in the number of layers.

Visualization of the idea of multiple layers

There are two ways to use this generator:

There are examples in the examples folder.

###1. Include the generator in the website Add the generator (it’s in the dist folder) to your html file and let it set the background to the element directly.

include_generator_example.html

> html lang pl-s">en"> head> style type pl-s">text/css">#colorful < height: 30em; width: 30em; padding: 1em; >style> head> body> div id pl-s">colorful">This element will have the colorful background.div> script src pl-s">https://raw.githubusercontent.com/webcore-it/colorful-background-css-generator/master/dist/colorful-background-css-generator.min.js" type pl-s">text/javascript">script> script type pl-s">text/javascript"> // The Generator var generator = new ColorfulBackgroundGenerator(); // This adds 5 layers to the generator // The parameters are: degree303, // h24, // s1, // l1, // posColor84, // posTransparency45 // The lowest layer (at the bottom) in the css is the first added layer. generator.addLayer(new ColorfulBackgroundLayer(degree: 325, h: 5, s: 0.95, l: 0.55,posColor: 100>)); // bottom layer generator.addLayer(new ColorfulBackgroundLayer(degree: 225, h: 75, s: 0.9, l: 0.7, posColor: 30, posTransparency: 80>)); generator.addLayer(new ColorfulBackgroundLayer(degree: 155, h: 150, s: 0.95, l: 0.7, posColor: 10, posTransparency: 80>)); generator.addLayer(new ColorfulBackgroundLayer(degree: 55, h: 230, s: 0.95, l: 0.65, posColor: 0, posTransparency: 70>)); generator.addLayer(new ColorfulBackgroundLayer(degree: 20, h: 300, s: 0.9, l: 0.65, posColor: 0, posTransparency: 55>)); // top layer // Assign generated style to the element identified by it's id generator.assignStyleToElementId("colorful"); script> body> html> 

###2. Use it just as code generator Another way is to use the generator to generate the css for the background and add this generated css to your style.css.

generate_css_example.html

> html lang pl-s">en"> head>Generate the css classhead> body> pre id pl-s">code">pre> script src pl-s">https://raw.githubusercontent.com/webcore-it/colorful-background-css-generator/master/dist/colorful-background-css-generator.min.js" type pl-s">text/javascript">script> script type pl-s">text/javascript"> // The Generator var generator = new ColorfulBackgroundGenerator(); // This adds 3 layers to the generator // The parameters are: degree352, // h109, // s1, // l1, // posColor5, // posTransparency32 // The lowest layer (at the bottom) in the css is the first added layer. generator.addLayer(new ColorfulBackgroundLayer(degree: 50, h: 35, s: 0.95, l: 45, posColor: 100>)); // bottom layer generator.addLayer(new ColorfulBackgroundLayer(degree: 140, h: 220, s: 0.9, l: 0.7, posColor: 30, posTransparency: 80>)); generator.addLayer(new ColorfulBackgroundLayer(degree: 210, h: 340, s: 0.9, l: 0.65, posColor: 10, posTransparency: 55>)); // top layer // Print the css style. var element = document.getElementById("code"); element.innerHTML = generator.getCSSAsText(); script> body> html>
  • Choose a high saturation between 80 and 100
  • Choose a lightness between 40 and 60
  • The lowest (first added) layer should have the posTransparency at 100 and posColor > 50 to make the lowest layer more colorful then the other layers

The only magic are css gradients. So it works with

  • Firefox 16+
  • Safari 5.1+
  • Chrome 10+
  • Internet Explorer 10+
  • Opera 12.1+
  • iOS 5.1+
  • Android 4+
  • Blackberry 10+
  • IE Mobile 10+

###Transparency in Firefox This is fixed in Firefox 36+ but an issue in earlier versions.

Firefox renders transparency in gradients different than webkit. The trick is to not use transparent or rgba(0,0,0,0) but the first color with alpha transparency = 0.

/* This fades to gray first before fading to transparent. */ div.gray < background: linear-gradient(0deg, hsla(0,100%,50%,1) 0%, transparent 100%); > /* This fades from color to transparent. */ div.color < background: linear-gradient(0deg, hsla(0,100%,50%,1) 0%, hsla(0,100%,50%,0) 100%); >

Open this fiddle with Firefox version 16 till 35 to see the difference.

###Degrees counting in webkit

  • Prefixed -webkit-linear-gradient is counting degrees counterclockwise.
    0° is at the left side.
  • The standard linear-gradient is counting degrees clockwise.
    0° is at the bottom side.

To convert the degrees of the standard linear-gradient to the -webkit-prefix degrees: (360 — standard-degrees) + 90

Open this fiddle in Chrome 26+ (or Safari 6.1+) to see the difference.

Copyright (c) 2014 webcore-it

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the «Software»), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED «AS IS», WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A colorful css gradient background generator

Источник

CSS Background Pattern Generator

CSS Background Pattern Generator is a free online tool for creating CSS-only background patterns. Developers mostly use images for background patterns, but if you need more performant ways to add patterns to your web page, CSS-only background patterns are the best way to achieve this since image files decreases loading performance of web pages.

CSS background patterns can add depth, texture, and interest to your website’s design. Whether you want to create a subtle, cohesive look or make a bold statement, there’s a background pattern for every style.

There are several types of CSS background patterns to choose from, including tiling patterns and seamless patterns. Tiling patterns repeat in a grid-like fashion to fill the entire background, while seamless patterns create the illusion of a continuous design that has no visible edges when tiled. Both types of patterns can range from simple, geometric shapes to more complex, organic designs.

CSS gradients can also be used as background patterns, providing a smooth transition between two or more colors. They can be linear, radial, or conic and can be customized with a variety of options, including direction, angle, and stops.

When using background patterns, it’s important to consider how they will fit into your overall design scheme. Choose patterns that complement your branding, color scheme, and style, and avoid using too many patterns or overly complex patterns that can be overwhelming or distract from your content.

With a little creativity and some basic CSS knowledge, you can add some visually striking elements to your website with CSS background patterns. Experiment with different patterns and see what works best for your design.

Different CSS Background Pattern Types Generated by the Tool

One common use for CSS patterns is as a background for a website or section of a page. By applying a repeating pattern as a background, it is possible to add depth and interest to an otherwise plain design. Patterns can also be used to highlight certain sections of a page or to draw the eye to a particular element.

In addition to using patterns as backgrounds, they can also be applied to other elements on a page, such as buttons, forms, and menus. This can help to give these elements a more polished and cohesive look, while also adding visual interest.

CSS patterns can be used to add texture and depth to flat designs, or to add a touch of whimsy to more formal layouts. They can be used to create a cohesive look across a website, or to add contrast and interest to a particular section of a page.

Overall, CSS patterns are a versatile design tool that can be used in a variety of situations to add visual interest and style to a website. Whether you are looking to add depth and texture to a flat design, or to add a touch of whimsy to a more formal layout, there is a CSS pattern that can help you achieve your desired look and feel.

Different types of CSS background patterns are available in the tool. Both 2D and 3D CSS patterns are listed. 2D patterns are checks, diamonds, grid, dot, cross dots, vertical lines, horizontal lines, diagonal lines, vertical stripes, horizontal stripes, diagonal stripes, crosses, pluses, equilateral triangles, right triangles, mixed triangles, pies, nested squares, snakes, bars, long bars, post it, mountains, hexagons, net, steps, tablecloth, hamper, knitting, wind rose, fences, polka dot, broken dots, connected nodes, connected squares, overlaying circles, hypnotic, honeycomb, carpet, hearts, stars, ninja blades, peppers, lemons, candy stripes, spaghetti, water drop, waves, and zigzag. There are 64 patterns in total and some of them are 3D patterns which are zigzag, adjacent cubes, discrete cubes, nested cubes, buildings, rooms, tubes, stairs and pyramids. You can choose any of them according to your needs in your design, set the sizes and implement directly into your code by copying and pasting the CSS code into your stylesheet. You can use these patterns on your hero sections, sepatators, fonts, or used coupled with images to give layer effects.

How to use Online CSS Background Pattern Generator?

CSS patterns can be created easily by following the guide below.

  1. First, select pattern type from the list. Each pattern has a mini preview in the list which gives you opinion about the pattern.
  2. Select the desired colors that you want to use in your project. There are two of them, one is for the color of pattern shapes and other is for background.
  3. Set size of the pattern units in pixel. All patterns are formed by using repetitive backgrounds. You can set the unit width & height of these units.
  4. Some patterns have extra settings like dot size or line width. These values may be changed by using related settings.
  5. After setting all parameters and get the desired background pattern on previews, copy the CSS code, and paste it in your codebase.

Credits

  • This tool is inspired from the project pattern.css developed by Jiten Bansal.
  • css-pattern.com developed by Temani Afif is used as a source for some patterns.
  • «Discrete Cubes» pattern is inspired from the pen on CodePen.io created by Ana Tudor.

Источник

Читайте также:  Java stream collect to hashmap
Оцените статью