Apple won a patent for an Apple Pencil with an advanced Color Sensor System allowing artists to match colors from a palette of real-world objects  patentlyapple.com