Current work provides an algebraic and geometric technique for building topological quantum codes. From the lattice partition derived of quotient lattices Λ′/Λ of index m combined with geometric technique of the projections of vector basis Λ′ over vector basis Λ, we reproduce surface codes found in the literature with parameter [[2m2,2,|a|+|b|]] for the case Λ=Z2 and m=a2+b2, where a and b are integers that are not null, simultaneously. We also obtain a new class of surface code with parameters [[2m,2,|a|+|b|]] from the Λ=A2-lattice when m can be expressed as m=a2+ab+b2, where a and b are integer values. Finally, we will show how this technique can be extended to the construction of color codes with parameters [[18m,4,6(|a|+|b|)]] by considering honeycomb lattices partition A2/Λ′ of index m=9(a2+ab+b2) where a and b are not null integers.