Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ There are several options to change the appearance of svg or png:
| Option | Type | Default value | Description |
|--------------------|------------------------|---------------|-------------------------------------|
| scale | positive integer | 10 | changes size of rendered QR code |
| class | string | "" | add a CSS class to the svg tag |
| scale | positive integer | 10 | changes size of rendered QR code |
| background_opacity | nil or 0.0 <= x <= 1.0 | nil | sets background opacity of svg |
| background_color | string or {r, g, b} | "#ffffff" | sets background color of svg |
| qrcode_color | string or {r, g, b} | "#000000" | sets color of QR |
Expand Down
7 changes: 4 additions & 3 deletions lib/qr_code/render/svg.ex
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,16 @@ defmodule QRCode.Render.Svg do
qrcode_color: qc,
flatten: flatten,
scale: scale,
structure: structure
structure: structure,
class: class
}
) do
{:svg,
%{
xmlns: xmlns,
xlink: xlink,
width: rank_matrix * scale,
height: rank_matrix * scale
viewBox: "0 0 #{rank_matrix * scale} #{rank_matrix * scale}",
class: class
}, [background_rect(bg, bg_tr), body_type(body, qc, flatten), put_image(image)]}
|> XmlBuilder.generate(format: format(structure))
end
Expand Down
4 changes: 3 additions & 1 deletion lib/qr_code/render/svg_settings.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ defmodule QRCode.Render.SvgSettings do
@type structure :: :minify | :readable

@type t :: %__MODULE__{
class: String.t(),
scale: integer,
image: image,
background_opacity: background_opacity,
Expand All @@ -36,5 +37,6 @@ defmodule QRCode.Render.SvgSettings do
background_color: "#ffffff",
qrcode_color: "#000000",
flatten: false,
structure: :minify
structure: :minify,
class: ""
end
6 changes: 4 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@ defmodule QRCode.MixProject do

defp package do
[
organization: "blake_elearning",
maintainers: [
"Jindrich K. Smitka <smitka.j@gmail.com>",
"Ondrej Tucek <ondrej.tucek@gmail.com>"
"Ondrej Tucek <ondrej.tucek@gmail.com>",
"Martin Feckie <martin.feckie@3plearning.com>"
],
licenses: ["BSD-4-Clause"],
links: %{
"GitHub" => "https://github.com/iodevs/qr_code"
"GitHub" => "https://github.com/blake-education/qr_code/tree/make-styling-easier"
}
]
end
Expand Down