Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7160295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:22:33+00:00 2026-05-28T13:22:33+00:00

I have a requirement to fill a shape with a two colours – like

  • 0

I have a requirement to fill a shape with a two colours – like a chess board.

I have seen some gradient effects with css but have not seen any examples like this.

Would this even be possible in Html5 Canvas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:22:34+00:00Added an answer on May 28, 2026 at 1:22 pm

    You sure can. In fact you can fill any arbitrary shape with any repeatable thing, even with shapes that you make in the Canvas itself!

    Here’s an example of an arbitrary shape getting filled with “pea pods” that were defined on a canvas: http://jsfiddle.net/NdUcv/

    Here it is with a simple checkerboard pattern: http://jsfiddle.net/NdUcv/2/

    That second one makes a shape fill look like this:

    enter image description here

    I create that pattern by making a canvas and then drawing whatever I want to repeat on it:

    var pattern = document.createElement('canvas');
    pattern.width = 40;
    pattern.height = 40;
    var pctx = pattern.getContext('2d');
    
    // Two green rects make a checkered square: two green, two transparent (white)
    pctx.fillStyle = "rgb(188, 222, 178)";
    pctx.fillRect(0,0,20,20);
    pctx.fillRect(20,20,20,20);
    

    Then on my normal canvas I can do:

    var pattern = ctx.createPattern(pattern, "repeat");
    ctx.fillStyle = pattern;
    

    and draw fill anything with that pattern.

    Of course it doesn’t have to be a canvas path, you could use a checkerboard image (or any kind of image) and fill a shape with it using the canvas patterns.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have requirement like, suppose I have a 'property' table which has 'ListingKey' field
We have the requirement to take a form submission and save some data, then
Hi i have a typical requirement in my web application, i have to fill
I have an requirement where i have to display some content on iframe dynamically.
I have two relative layouts. Both have width of fill parent and height of
I have an MVC3 project with a requirement to use LDAP to fill in
I have requirement of specifying web part connections in onet.xml. So when site is
In our project we have requirement that, after receiving sms message from third party
We have a requirement in project to store all the revisions(Change History) for the
I have a requirement to make a large amount of code MISRA compliant. First

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.