Skip to content

Styling Options

Customize the appearance of your QR codes by passing a style object when creating or updating.

Style Object Structure

json
{
  "style": {
    "dotsOptions": { ... },
    "cornersSquareOptions": { ... },
    "cornersDotOptions": { ... },
    "backgroundOptions": { ... },
    "image": "https://example.com/logo.png",
    "imageOptions": { ... }
  }
}

Dots Options

Control the appearance of individual QR data dots.

FieldTypeDescription
typestringDot shape (see table below)
colorstringHex color (e.g., "#000000")
gradientobjectGradient config (overrides color)

Dot Types

ValueDescription
squareStandard square dots (default)
roundedRounded squares
dotsCircular dots
classyClassy triangular style
classy-roundedClassy with rounded edges
extra-roundedExtra rounded squares

Example with solid color

json
{
  "dotsOptions": {
    "type": "rounded",
    "color": "#1a1a2e"
  }
}

Example with gradient

json
{
  "dotsOptions": {
    "type": "dots",
    "gradient": {
      "rotation": 45,
      "colorStops": [
        { "offset": 0, "color": "#667eea" },
        { "offset": 1, "color": "#764ba2" }
      ]
    }
  }
}

Corners Square Options

Control the large corner square patterns (3 finder patterns).

FieldTypeDescription
typestringCorner shape
colorstringHex color
gradientobjectGradient config

Corner Square Types

ValueDescription
squareStandard square
dotCircular
roundedRounded
extra-roundedExtra rounded

Corners Dot Options

Control the small dot inside each corner square.

Same fields as corners square options. Types available: square, dot, rounded, extra-rounded.

Background Options

FieldTypeDescription
colorstringBackground hex color (default: "#ffffff")
gradientobjectBackground gradient
json
{
  "backgroundOptions": {
    "color": "#f0f0f0"
  }
}

Gradient Object

All gradient configurations follow this structure:

FieldTypeDescription
rotationnumberRotation angle in degrees (0–360)
colorStopsarrayArray of 2 color stops

Each color stop:

FieldTypeDescription
offsetnumberPosition (0 = start, 1 = end)
colorstringHex color

Logo / Image Embedding

Embed a logo in the center of the QR code.

FieldTypeDescription
imagestringURL to the logo image
imageOptions.hideBackgroundDotsbooleanRemove dots behind the logo (default: true)
imageOptions.imageSizenumberLogo size ratio (0.1–1.0, default: 0.4)
imageOptions.marginnumberMargin around the logo in px
json
{
  "image": "https://example.com/logo.png",
  "imageOptions": {
    "hideBackgroundDots": true,
    "imageSize": 0.3,
    "margin": 5
  }
}

TIP

Logos are embedded via SVG <image> tags. For best results, use a square logo that is clearly visible at small sizes. The error correction in the QR code compensates for the occluded area.

Full Style Example

json
{
  "style": {
    "dotsOptions": {
      "type": "classy-rounded",
      "gradient": {
        "rotation": 135,
        "colorStops": [
          { "offset": 0, "color": "#667eea" },
          { "offset": 1, "color": "#764ba2" }
        ]
      }
    },
    "cornersSquareOptions": {
      "type": "extra-rounded",
      "color": "#1a1a2e"
    },
    "cornersDotOptions": {
      "type": "dot",
      "color": "#667eea"
    },
    "backgroundOptions": {
      "color": "#ffffff"
    },
    "image": "https://example.com/logo.png",
    "imageOptions": {
      "hideBackgroundDots": true,
      "imageSize": 0.35,
      "margin": 4
    }
  }
}

QBar Scanner Developer API