Skip to main content
added 109 characters in body
Source Link
Qaziquza
  • 1.7k
  • 2
  • 11
  • 34

Nim-lang, 862 274274 246 bytes

import pixie
var 
  y=33.0
  m=newImage(330,198)
  c=newContext(m)
  s=vec2(y*9,y/2)
  t=vec2(0,y/2)
  q=vec2(0,y)
for i in 0..5:c.strokeStyle="#FF5C00#FF8C00#FFE900#006400#00008B#4B0082"[i*7..i*7+6];c.lineWidth=y;c.strokeSegment(segment(t,s));t+=q;s+=q;m.writeFile("l.png")
var
  y=33.0
  m=newImage(297,198)
  c=newContext(m)
  r=y/2
for i in 0..5:c.strokeStyle="#FF5C00#FF8C00#FFE900#006400#00008B#4B0082"[i*7..i*7+6];c.lineWidth=y;c.strokeSegment(segment(vec2(0,r),vec2(y*9,r)));r+=y;m.writeFile("l.png")

Using the Nim library pixie. If you have Nim and Nimble installed, a quick nimble install pixie should let you run it perfectly! It outputs to l.png. I am inexperienced with Pixie and Nim, so if I did anything wrong, please let me know. This answer has gone through a lot of revisions, from totally un-golfy to fairly golfed. Bytes were counted using wc -c.

stackAn image of the pride flag created by my code.

Nim-lang, 862 274 bytes

import pixie
var 
  y=33.0
  m=newImage(330,198)
  c=newContext(m)
  s=vec2(y*9,y/2)
  t=vec2(0,y/2)
  q=vec2(0,y)
for i in 0..5:c.strokeStyle="#FF5C00#FF8C00#FFE900#006400#00008B#4B0082"[i*7..i*7+6];c.lineWidth=y;c.strokeSegment(segment(t,s));t+=q;s+=q;m.writeFile("l.png")

Using the Nim library pixie. If you have Nim and Nimble installed, a quick nimble install pixie should let you run it perfectly! It outputs to l.png. I am inexperienced with Pixie and Nim, so if I did anything wrong, please let me know.

stack

Nim, 862 274 246 bytes

var
  y=33.0
  m=newImage(297,198)
  c=newContext(m)
  r=y/2
for i in 0..5:c.strokeStyle="#FF5C00#FF8C00#FFE900#006400#00008B#4B0082"[i*7..i*7+6];c.lineWidth=y;c.strokeSegment(segment(vec2(0,r),vec2(y*9,r)));r+=y;m.writeFile("l.png")

Using the Nim library pixie. If you have Nim and Nimble installed, a quick nimble install pixie should let you run it perfectly! It outputs to l.png. I am inexperienced with Pixie and Nim, so if I did anything wrong, please let me know. This answer has gone through a lot of revisions, from totally un-golfy to fairly golfed. Bytes were counted using wc -c.

An image of the pride flag created by my code.

deleted 804 characters in body
Source Link
Qaziquza
  • 1.7k
  • 2
  • 11
  • 34

Nim-lang, 862862 274 bytes

import pixie
let m=newImage(300,160)
m.fill(rgba(255,255,255,255))
let c=newContext(m)
c.strokeStyle="#FF5C00"
c.lineWidth=27
let a=newContext(m)
a.strokeStyle="#FF8C00"
a.lineWidth=27
let e=newContext(m)
e.strokeStyle="#FFE900"
e.lineWidth=27
letvar d=newContext(m)
d.strokeStyle="#006400"
d.lineWidth=27
let z=newContext(m)
z.strokeStyle="#00008B"
z.lineWidth=27
let rn=newContext(m)
rn.strokeStyle="#4B0082"
rny=33.lineWidth=27
let
  t=vec2(0,14)
  s=vec2(300,14)
let 
  q=vec2(0,41)
  r=vec2m=newImage(300330,41198)
let
  ql=vec2c=newContext(0,68m)
  br=vec2s=vec2(300y*9,68y/2)
let
  qb=vec2t=vec2(0,95)
  bn=vec2(300,95y/2)
let
  qq=vec2q=vec2(0,122y)
 for bb=vec2(300,122)
let
i in qt=vec2(0,149)
  by=vec2(300,149)
c.strokeSegment(segment(t,s))
a.strokeSegment(segment(q,r))
e5:c.strokeSegment(segment(ql,br))
dstrokeStyle="#FF5C00#FF8C00#FFE900#006400#00008B#4B0082"[i*7.strokeSegment(segment(qb,bn))
z.strokeSegment(segment(qq,bb))
rni*7+6];c.lineWidth=y;c.strokeSegment(segment(qtt,bys))
m;t+=q;s+=q;m.writeFile("l.png")

enter image description here

Using the Nim library pixie. If you have Nim and Nimble installed, a quick nimble install pixie should let you run it perfectly! It outputs to l.png. I am inexperienced with Pixie and Nim, so if I did anything wrong, please let me know.

stack

Nim-lang, 862 bytes

import pixie
let m=newImage(300,160)
m.fill(rgba(255,255,255,255))
let c=newContext(m)
c.strokeStyle="#FF5C00"
c.lineWidth=27
let a=newContext(m)
a.strokeStyle="#FF8C00"
a.lineWidth=27
let e=newContext(m)
e.strokeStyle="#FFE900"
e.lineWidth=27
let d=newContext(m)
d.strokeStyle="#006400"
d.lineWidth=27
let z=newContext(m)
z.strokeStyle="#00008B"
z.lineWidth=27
let rn=newContext(m)
rn.strokeStyle="#4B0082"
rn.lineWidth=27
let
  t=vec2(0,14)
  s=vec2(300,14)
let 
  q=vec2(0,41)
  r=vec2(300,41)
let
  ql=vec2(0,68)
  br=vec2(300,68)
let
  qb=vec2(0,95)
  bn=vec2(300,95)
let
  qq=vec2(0,122)
  bb=vec2(300,122)
let
  qt=vec2(0,149)
  by=vec2(300,149)
c.strokeSegment(segment(t,s))
a.strokeSegment(segment(q,r))
e.strokeSegment(segment(ql,br))
d.strokeSegment(segment(qb,bn))
z.strokeSegment(segment(qq,bb))
rn.strokeSegment(segment(qt,by))
m.writeFile("l.png")

enter image description here

Using the Nim library pixie. If you have Nim and Nimble installed, a quick nimble install pixie should let you run it perfectly! It outputs to l.png. I am inexperienced with Pixie and Nim, so if I did anything wrong, please let me know.

Nim-lang, 862 274 bytes

import pixie
var 
  y=33.0
  m=newImage(330,198)
  c=newContext(m)
  s=vec2(y*9,y/2)
  t=vec2(0,y/2)
  q=vec2(0,y)
for i in 0..5:c.strokeStyle="#FF5C00#FF8C00#FFE900#006400#00008B#4B0082"[i*7..i*7+6];c.lineWidth=y;c.strokeSegment(segment(t,s));t+=q;s+=q;m.writeFile("l.png")

Using the Nim library pixie. If you have Nim and Nimble installed, a quick nimble install pixie should let you run it perfectly! It outputs to l.png. I am inexperienced with Pixie and Nim, so if I did anything wrong, please let me know.

stack

deleted 184 characters in body
Source Link

Nim-lang, 862 bytes

    import pixie
    let m=newImage(300,160)
    m.fill(rgba(255,255,255,255))
    let c=newContext(m)
    c.strokeStyle="#FF5C00"
    c.lineWidth=27
    let a=newContext(m)
    a.strokeStyle="#FF8C00"
    a.lineWidth=27
    let e=newContext(m)
    e.strokeStyle="#FFE900"
    e.lineWidth=27
    let d=newContext(m)
    d.strokeStyle="#006400"
    d.lineWidth=27
    let z=newContext(m)
    z.strokeStyle="#00008B"
    z.lineWidth=27
    let rn=newContext(m)
    rn.strokeStyle="#4B0082"
    rn.lineWidth=27
    let
      t=vec2(0,14)
      s=vec2(300,14)
    let 
      q=vec2(0,41)
      r=vec2(300,41)
    let
      ql=vec2(0,68)
      br=vec2(300,68)
    let
      qb=vec2(0,95)
      bn=vec2(300,95)
    let
      qq=vec2(0,122)
      bb=vec2(300,122)
    let
      qt=vec2(0,149)
      by=vec2(300,149)
    c.strokeSegment(segment(t,s))
    a.strokeSegment(segment(q,r))
    e.strokeSegment(segment(ql,br))
    d.strokeSegment(segment(qb,bn))
    z.strokeSegment(segment(qq,bb))
    rn.strokeSegment(segment(qt,by))
    m.writeFile("l.png")

enter image description here

Using the Nim library pixie. If you have Nim and Nimble installed, a quick nimble install pixie should let you run it perfectly! It outputs to l.png. I am inexperienced with Pixie and Nim, so if I did anything wrong, please let me know.

Nim-lang, 862 bytes

    import pixie
    let m=newImage(300,160)
    m.fill(rgba(255,255,255,255))
    let c=newContext(m)
    c.strokeStyle="#FF5C00"
    c.lineWidth=27
    let a=newContext(m)
    a.strokeStyle="#FF8C00"
    a.lineWidth=27
    let e=newContext(m)
    e.strokeStyle="#FFE900"
    e.lineWidth=27
    let d=newContext(m)
    d.strokeStyle="#006400"
    d.lineWidth=27
    let z=newContext(m)
    z.strokeStyle="#00008B"
    z.lineWidth=27
    let rn=newContext(m)
    rn.strokeStyle="#4B0082"
    rn.lineWidth=27
    let
      t=vec2(0,14)
      s=vec2(300,14)
    let 
      q=vec2(0,41)
      r=vec2(300,41)
    let
      ql=vec2(0,68)
      br=vec2(300,68)
    let
      qb=vec2(0,95)
      bn=vec2(300,95)
    let
      qq=vec2(0,122)
      bb=vec2(300,122)
    let
      qt=vec2(0,149)
      by=vec2(300,149)
    c.strokeSegment(segment(t,s))
    a.strokeSegment(segment(q,r))
    e.strokeSegment(segment(ql,br))
    d.strokeSegment(segment(qb,bn))
    z.strokeSegment(segment(qq,bb))
    rn.strokeSegment(segment(qt,by))
    m.writeFile("l.png")

enter image description here

Using the Nim library pixie. If you have Nim and Nimble installed, a quick nimble install pixie should let you run it perfectly! It outputs to l.png. I am inexperienced with Pixie and Nim, so if I did anything wrong, please let me know.

Nim-lang, 862 bytes

import pixie
let m=newImage(300,160)
m.fill(rgba(255,255,255,255))
let c=newContext(m)
c.strokeStyle="#FF5C00"
c.lineWidth=27
let a=newContext(m)
a.strokeStyle="#FF8C00"
a.lineWidth=27
let e=newContext(m)
e.strokeStyle="#FFE900"
e.lineWidth=27
let d=newContext(m)
d.strokeStyle="#006400"
d.lineWidth=27
let z=newContext(m)
z.strokeStyle="#00008B"
z.lineWidth=27
let rn=newContext(m)
rn.strokeStyle="#4B0082"
rn.lineWidth=27
let
  t=vec2(0,14)
  s=vec2(300,14)
let 
  q=vec2(0,41)
  r=vec2(300,41)
let
  ql=vec2(0,68)
  br=vec2(300,68)
let
  qb=vec2(0,95)
  bn=vec2(300,95)
let
  qq=vec2(0,122)
  bb=vec2(300,122)
let
  qt=vec2(0,149)
  by=vec2(300,149)
c.strokeSegment(segment(t,s))
a.strokeSegment(segment(q,r))
e.strokeSegment(segment(ql,br))
d.strokeSegment(segment(qb,bn))
z.strokeSegment(segment(qq,bb))
rn.strokeSegment(segment(qt,by))
m.writeFile("l.png")

enter image description here

Using the Nim library pixie. If you have Nim and Nimble installed, a quick nimble install pixie should let you run it perfectly! It outputs to l.png. I am inexperienced with Pixie and Nim, so if I did anything wrong, please let me know.

Source Link
Qaziquza
  • 1.7k
  • 2
  • 11
  • 34
Loading