The Yellowknife Bay formation represents a ~5 m thick stratigraphic section of lithified fluvial and lacustrine sediments analyzed by the Curiosity rover in Gale crater, Mars. Previous works have mainly focused on the mudstones that were drilled by the rover at two locations. The present study focuses on the sedimentary rocks stratigraphically above the mudstones by studying their chemical variations in parallel with rock textures. Results show that differences in composition correlate with textures and both manifest subtle but significant variations through the stratigraphic column. Though the chemistry of the sediments does not vary much in the lower part of the stratigraphy, the variations in alkali elements indicate variations in the source material and/or physical sorting, as shown by the identification of alkali feldspars. The sandstones contain similar relative proportions of hydrogen to the mudstones below, suggesting the presence of hydrous minerals that may have contributed to their cementation. Slight variations in magnesium correlate with changes in textures suggesting that diagenesis through cementation and dissolution modified the initial rock composition and texture simultaneously. The upper part of the stratigraphy (~1 m thick) displays rocks with different compositions suggesting a strong change in the depositional system. The presence of float rocks with similar compositions found along the rover traverse suggests that some of these outcrops extend further away in the nearby hummocky plains.