1.1.4 • Published 5 years ago

pixel-borders v1.1.4

Weekly downloads
7
License
MIT
Repository
github
Last release
5 years ago

Pixel borders

A Sass mixin to add pixelated borders to HTML elements, which can be customized for different sizes, styles and colour coding.

View demo

Installation

$ npm install pixel-borders --save-dev

Usage

Import

After installation you can import it into your Sass files with the statement below.

@import "node_modules/pixel-borders/src/styles/pixel-borders.scss";

You can also just import the mixins without the demo styles.

@import "node_modules/pixel-borders/src/styles/pixel-borders/pixel-borders-mixins";

Pixel borders mixin options

// Add pixel borders with default options
@include pixel-borders();

// Available options
@include pixel-borders(
  $corner-size: 1,                 
  $border-size: 4px,              
  $border-color: #000,            
  $border-inset-color: false
);

// Helper method to create custom styles e.g. colour themes, inset border, highlight
@include pixel-box(
  $corner-size,
  $border-size, 
  $background-color,              
  $border-color: false,           
  $border-inset: true,            
  $border-inset-size: false,      
  $border-inset-color: false,     
  $border-inset-sides: false,     // Sides to apply inset border: 'all', 'top-left' or 'bottom-right'
  $border-inset-color-br: false,  // Bottom right inset border colour
  $border-inset-color-tl: false   // Top left inset border colour
);

pixel-borders

PropertyDefaultTypeDescription
$corner-size1NumberNumber of pixels taken out of the corner.
$border-size4pxNumber(px)Border size.
$border-color#000Hexadecimal colorBorder colour.
$border-inset-colorfalseFalse/Hexadecimal colorAdd a inset border to the bottom right in this colour.

pixel-box

PropertyDefaultTypeDescription
$corner-sizeNumberNumber of pixels taken out of the corner.
$border-sizeNumber(px)Border size.
$background-colorHexadecimal colorBackground colour for the box, this is used as a base for colour theme.
$border-colorDarkened $background-colorFalse/Hexadecimal colourBorder colour.
$border-insettrueBooleanAdd a inset border.
$border-inset-size$border-sizeFalse/Number(px)Inset border size.
$border-inset-colorDarkened $background-colorFalse/Hexadecimal colorInset border colour.
$border-inset-sides'bottom-right'StringWhich sides to add inset border to, 'all', 'top-left' or 'bottom-right'.
$border-inset-sides-br$border-inset-colorFalse/Hexadecimal colorBottom right inset border colour.
$border-inset-sides-tlLightened $background-colorFalse/Hexadecimal colorTop left inset border colour.

Classes

A class of .pixel-borders is applied all elements with a pixel border for demo purposes only, you should be able to add pixel borders to any elements.

The pixel borders mixin comes with a number of classes defined to demonstrate how it can be used. These can be used as is but I would encourage users to create their own customized classes.

Demo site

Clone or download from Github.

    $ npm install
    $ gulp serve

Credits

Inspired by the excellent NES.css which is a full NES-style CSS framework. Pixel borders is intended to be used where only the borders are required.

License

MIT © Nigel O Toole

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago